Last active
February 20, 2016 12:04
-
-
Save ilkinulas/cfae79ef211fd51d72f0 to your computer and use it in GitHub Desktop.
NUnit test example
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
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