Skip to content

Instantly share code, notes, and snippets.

@lordlycastle
Last active May 28, 2019 11:25
Show Gist options
  • Save lordlycastle/77052b6123611ae2fc0980eae88422f9 to your computer and use it in GitHub Desktop.
Save lordlycastle/77052b6123611ae2fc0980eae88422f9 to your computer and use it in GitHub Desktop.
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