On Github astraldragon / unit-testing-presentation
Explanation here
Explanation here
.NET - NUnit, Visual Studio Testing Framework
Java - JUnit
describe('Twitter', function() { describe("convertUsername", function() { it("should create a username link for text in a tweet that begins with @", function() { // Arrange var tweet = '@salesforce - check this out!'; // Act tweet = Twitter.convertUsername(tweet); // Assert expect(tweet).toBe('<a href="https://twitter.com/salesforce">@salesforce</a> - check this out!'); }); }); });
(function() { var Twitter = Twitter || {}; this.Twitter = Twitter; Twitter.convertUsername = function(tweet) { return tweet.replace(/[@]+[A-Za-z0-9-_]+/g, function(u) { var username = u.replace("@","") return u.link("https://twitter.com/" + username); }); } })();
We will be making an English to Pig Latin translator
We will test code that has an external dependency by using mocks with Moq.
Presentation can be found at https://github.com/astraldragon/nbcc-presentation