File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -18,16 +18,19 @@ public abstract class Solver<TInput, TResult>
1818 /// <summary>
1919 /// The puzzle input
2020 /// </summary>
21- public readonly TInput PuzzleInput ;
21+ public readonly Lazy < TInput > PuzzleInput ;
2222
2323 /// <summary>
2424 /// Create a new solver and initialize its puzzle input based on the provided <see cref="IPuzzleInputReaderStrategy"/>
2525 /// </summary>
2626 /// <param name="puzzleInputReader">The strategy to use to retriever the puzzle input</param>
2727 private Solver ( IPuzzleInputReaderStrategy puzzleInputReader )
2828 {
29- var content = puzzleInputReader . ReadInput ( ) ;
30- PuzzleInput = ParseInput ( content ) ;
29+ PuzzleInput = new Lazy < TInput > ( ( ) =>
30+ {
31+ var content = puzzleInputReader . ReadInput ( ) ;
32+ return ParseInput ( content ) ;
33+ } ) ;
3134 }
3235
3336 /// <summary>
Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ public void PartOneSolutionTest()
101101 var input = _solver . PuzzleInput ;
102102
103103 // Act
104- var result = _solver . PartOne ( input ) ;
104+ var result = _solver . PartOne ( input . Value ) ;
105105
106106 // Assert
107107 result . Should ( ) . Be ( PartOne . Solution ) ;
@@ -137,7 +137,7 @@ public void PartTwoSolutionTest()
137137 var input = _solver . PuzzleInput ;
138138
139139 // Act
140- var result = _solver . PartTwo ( input ) ;
140+ var result = _solver . PartTwo ( input . Value ) ;
141141
142142 // Assert
143143 result . Should ( ) . Be ( PartTwo . Solution ) ;
You can’t perform that action at this time.
0 commit comments