Last active
July 28, 2022 21:54
-
-
Save es-repo/c2ed03ec01115d655be3df8346f55534 to your computer and use it in GitHub Desktop.
better-unit-test-in-c#-article-FillBoxTest-layout.cs
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 static class FillBoxTest | |
{ | |
public sealed record Args | |
{ | |
public IBox Box { get; init; } = null!; | |
public Dictionary<string, Thing> LabelsAndThings { get; init; } = new(); | |
public WriteLog WriteLog { get; init; } = null!; | |
} | |
sealed class TestCases : IEnumerable<object[]> | |
{ | |
... | |
} | |
[Theory] | |
[ClassData(typeof(TestCases))] | |
public static void Test( | |
Args args, | |
Dictionary<string, Thing> expected) | |
{ | |
var actual = Operations.FillBox(args.Box, args.LabelsAndThings, args.WriteLog); | |
Assert.Equal(expected, actual); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment