Created
August 2, 2015 14:29
-
-
Save alexwirz/926f054f6705914c8778 to your computer and use it in GitHub Desktop.
Create test combinations for legacy code.
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
[UseReporter(typeof(DiffReporter))] | |
[TestClass] | |
public class TestCombinations | |
{ | |
public string RunLegacyManagerProcessor(string a, int b, bool c) | |
{ | |
if (c) return "42"; | |
if (b > 12) return a.Length.ToString(); | |
return b.ToString(); | |
} | |
[TestMethod] | |
public void TestAllCombinations() | |
{ | |
var name = new[] { "Jack" }; | |
var age = new[] { 42 }; | |
var isRegistered = new[] { false }; | |
CombinationApprovals.VerifyAllCombinations(RunLegacyManagerProcessor, name, age, isRegistered); | |
} | |
[TestMethod] | |
public void TestMoreCombinations() | |
{ | |
var name = new[] { "Jack", "John", "Steve" }; | |
var age = new[] { 42, 23, 15 }; | |
var isRegistered = new[] { false, true }; | |
CombinationApprovals.VerifyAllCombinations(RunLegacyManagerProcessor, name, age, isRegistered); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment