Skip to content

Instantly share code, notes, and snippets.

@gangleri
Last active June 2, 2017 22:02
Show Gist options
  • Save gangleri/69bcc7acada44a25a715075e3c62a0e0 to your computer and use it in GitHub Desktop.
Save gangleri/69bcc7acada44a25a715075e3c62a0e0 to your computer and use it in GitHub Desktop.
Test Driven Development: A developer’s safety net
[TestMethod]
public void TestAddPositiveNumbers()
{
Calculator cal = new Calculator();
int result = cal.Add(2, 2);
Assert.AreEqual(4, result);
}
public int Add(int first, int second)
{
throw new NotImplementedException();
}
public void TestAddNegativeNumbers()
{
Calculator cal = new Calculator();
int result = cal.Add(-2, -2);
Assert.AreEqual(-4, result);
}
public int Add(int first, int second)
{
return first + second;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment