Generating Tests - mazharenko/aoc-agent GitHub Wiki
-
Create a test project referencing both
AocAgent
package and the project with day implementations, as well as theNUnit
package. -
Opt out of agent generation setting the
false
value for a special property in the csproj file.<ItemGroup> <CompilerVisibleProperty Include="AoCAgent_GenerateAgent" /> </ItemGroup> <PropertyGroup> <AoCAgent_GenerateAgent>false</AoCAgent_GenerateAgent> </PropertyGroup>
-
Define a class decorated with the
[GenerateExampleTests]
attribute.[GenerateExampleTests] internal partial class ExampleTests;
-
The class now becomes a test fixture collecting examples from all the Days with a test method verifying them.
-
Define a class decorated with the
[GenerateInputTests]
attribute and provide your answers to puzzles. This will also require manually downloading your personal inputs.[GenerateInputTests(nameof(GetCases))] internal partial class InputTests { private static IEnumerable<PartInputCaseData> GetCases() { yield return new (1, 1, "56049"); } }
-
The class now becomes a test fixture verifying the solutions using inputs from the files.