Last active
May 28, 2019 11:25
-
-
Save lordlycastle/77052b6123611ae2fc0980eae88422f9 to your computer and use it in GitHub Desktop.
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 ContinueOnFailTest | |
{ | |
public struct MultiplyTestCase | |
{ | |
public int result; | |
public (int, int) input; | |
} | |
public int Multiply(int x, int y) => x * y; | |
private static readonly List<MultiplyTestCase> _testCases = | |
new List<MultiplyTestCase> | |
{ | |
new MultiplyTestCase {result = 4, input = (2, 2),}, | |
// Fail test case. | |
new MultiplyTestCase {result = 5, input = (2, 3),}, | |
// Success test case. | |
new MultiplyTestCase {result = 9, input = (3, 3),} | |
}; | |
[Test, TestCaseSource(nameof(_testCases))] | |
public void TestMultiply(MultiplyTestCase testCase) | |
{ | |
Assert.AreEqual(testCase.result, Multiply(testCase.input.Item1, testCase.input.Item2)); | |
} | |
[OneTimeTearDown] | |
public void Teardown() | |
{ | |
TestUtility.Log("Finished tests."); | |
} | |
[OneTimeSetUp] | |
public void SetUp() | |
{ | |
TestUtility.Log("Setting up."); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment