Created
March 30, 2015 01:47
-
-
Save danalexilewis/2b2abf5f46e38959eda5 to your computer and use it in GitHub Desktop.
hihi - nunit test demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using NUnit.Framework; | |
namespace UnitTestProject | |
{ | |
[TestFixture] | |
public class UnitTest1 | |
{ | |
CleverCalcutor calcutor; | |
[SetUp] | |
public void init() | |
{ | |
calcutor = new CleverCalcutor(); | |
} | |
[Test] | |
public void TestTester() | |
{ | |
Assert.IsTrue(true); | |
} | |
[Test] | |
public void Mulitplication_Returns_Expected() | |
{ | |
// Arrange | |
int expected = calcutor.expected; | |
calcutor.expected = 3; | |
calcutor.Times(); | |
} | |
[Test] | |
public void Add_Returns_Expected() | |
{ | |
// Arrange | |
int expected = calcutor.expected; | |
int actual; | |
// Act | |
actual = calcutor.Addition(8, 4); | |
// Assert | |
Assert.AreEqual(expected,actual); | |
} | |
} | |
} | |
namespace UnitTestProject | |
{ | |
public class CleverCalcutor | |
{ | |
public int expected = 12; | |
public void Times() | |
{ | |
throw new NotImplementedException(); | |
} | |
public int Addition(int p1, int p2) | |
{ | |
return p2 + p1; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment