Skip to content

Instantly share code, notes, and snippets.

@ilkinulas
Last active February 20, 2016 12:04
Show Gist options
  • Save ilkinulas/cfae79ef211fd51d72f0 to your computer and use it in GitHub Desktop.
Save ilkinulas/cfae79ef211fd51d72f0 to your computer and use it in GitHub Desktop.
NUnit test example
public class GameLogicTest {
[TestFixtureSetUp]
public void Init() {
//Init runs once before running test cases.
}
[TestFixtureTearDown]
public void CleanUp() {
//CleanUp runs once after all test cases are finished.
}
[SetUp]
public void SetUp() {
//SetUp runs before all test cases
}
[TearDown]
public void TearDown() {
//SetUp runs after all test cases
}
[Test]
public void SuccessfulGuess() {
GameLogic mastermind = new GameLogic (new int[] {1, 2, 3, 4});
int [] guess = new int [] {1, 2, 3, 4};
Result result = mastermind.Check (guess);
Assert.AreEqual (4, result.whiteCount);
Assert.AreEqual (0, result.blackCount);
Assert.IsTrue (result.IsCorrect ());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment