@@ -47,6 +47,14 @@ public record Example
4747 /// </summary>
4848 public record Puzzle
4949 {
50+ /// <summary>
51+ /// If set to <c>true</c>, the tests for this puzzle will be skipped
52+ /// </summary>
53+ /// <remarks>
54+ /// Default is <c>false</c>
55+ /// </remarks>
56+ public bool ShouldSkipTests { get ; init ; } = false ;
57+
5058 /// <summary>
5159 /// The <see cref="Example"/> to use to test <see cref="Solver{TInput, TResult}"/>
5260 /// </summary>
@@ -70,23 +78,33 @@ protected TestEngine()
7078
7179 public abstract Puzzle PartOne { get ; }
7280
73- [ Fact ( DisplayName = "Part One - Example" ) ]
81+ [ SkippableFact ( DisplayName = "Part One - Example" ) ]
7482 public void PartOneExampleTest ( )
7583 {
84+ Skip . If ( PartOne . ShouldSkipTests , "Puzzle.ShouldSkipTests has been set to true, test skipped" ) ;
85+
86+ // Arrange
7687 var input = PartOne . Example . Input ;
7788
89+ // Act
7890 var result = _solver . PartOne ( input ) ;
7991
92+ // Assert
8093 result . Should ( ) . Be ( PartOne . Example . Result ) ;
8194 }
8295
83- [ Fact ( DisplayName = "Part One - Solution" ) ]
96+ [ SkippableFact ( DisplayName = "Part One - Solution" ) ]
8497 public void PartOneSolutionTest ( )
8598 {
86- var input = _solver . Input ;
99+ Skip . If ( PartOne . ShouldSkipTests , "Puzzle.ShouldSkipTests has been set to true, test skipped" ) ;
87100
101+ // Arrange
102+ var input = _solver . Input ;
103+
104+ // Act
88105 var result = _solver . PartOne ( input ) ;
89106
107+ // Assert
90108 result . Should ( ) . Be ( PartOne . Solution ) ;
91109 }
92110
@@ -96,23 +114,33 @@ public void PartOneSolutionTest()
96114
97115 public abstract Puzzle PartTwo { get ; }
98116
99- [ Fact ( DisplayName = "Part Two - Example" ) ]
117+ [ SkippableFact ( DisplayName = "Part Two - Example" ) ]
100118 public void PartTwoExampleTest ( )
101119 {
120+ Skip . If ( PartTwo . ShouldSkipTests , "Puzzle.ShouldSkipTests has been set to true, test skipped" ) ;
121+
122+ // Arrange
102123 var input = PartTwo . Example . Input ;
103124
125+ // Act
104126 var result = _solver . PartTwo ( input ) ;
105127
128+ // Assert
106129 result . Should ( ) . Be ( PartTwo . Example . Result ) ;
107130 }
108131
109- [ Fact ( DisplayName = "Part Two - Solution" ) ]
132+ [ SkippableFact ( DisplayName = "Part Two - Solution" ) ]
110133 public void PartTwoSolutionTest ( )
111134 {
135+ Skip . If ( PartTwo . ShouldSkipTests , "Puzzle.ShouldSkipTests has been set to true, test skipped" ) ;
136+
137+ // Arrange
112138 var input = _solver . Input ;
113139
140+ // Act
114141 var result = _solver . PartTwo ( input ) ;
115142
143+ // Assert
116144 result . Should ( ) . Be ( PartTwo . Solution ) ;
117145 }
118146
0 commit comments