Last active
December 3, 2019 17:30
-
-
Save codingfab/9a3152d6300c1f79cb0f2677763e7985 to your computer and use it in GitHub Desktop.
Usage of TestCaseSource attribute with method name
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
[TestFixture] | |
public class MyComplexLogicShould | |
{ | |
[Test] | |
[TestCaseSource(nameof(GetTestCases))] | |
public int ReturnExpectedResult(int a, int b) | |
{ | |
var sut = new MyClass(); | |
return sut.MyComplexLogic(a,b); | |
} | |
public static IEnumerable<TestCaseData> GetTestCases() | |
{ | |
yield return new TestCaseData(10,22).Returns(32); | |
yield return new TestCaseData(20,44).Returns(64); | |
yield return new TestCaseData(15,17).Returns(32); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment