@@ -68,6 +68,37 @@ public void Coverage_IsPrime7()
6868 . Concat ( Methods . SampleStruct ) ) ;
6969 }
7070
71+ [ TestMethod ]
72+ public void Coverage_ResetHits_IsPrime2 ( )
73+ {
74+ _tester . RunApp ( ) ;
75+ _tester . ResetHits ( ) ;
76+ _tester . RunIsPrimeInApp ( 2 ) ;
77+ AssertVisitedFilesAndMethods (
78+ new string [ ] { Files . App }
79+ . Append ( Files . PrimeCalculator ) ,
80+ Methods . RunCommand
81+ . Concat ( Methods . PrimeCalculator . IsPrimeAndIsLessThan2 )
82+ . Append ( Methods . get_Commands ) ) ;
83+ }
84+
85+ [ TestMethod ]
86+ public void Coverage_ResetHits_IsPrime7 ( )
87+ {
88+ _tester . RunApp ( ) ;
89+ _tester . ResetHits ( ) ;
90+ _tester . RunIsPrimeInApp ( 7 ) ;
91+ AssertVisitedFilesAndMethods (
92+ new string [ ] { Files . App }
93+ . Append ( Files . PrimeCalculator )
94+ . Append ( Files . SampleStruct ) ,
95+ Methods . RunCommand
96+ . Concat ( Methods . PrimeCalculator . IsPrimeAndIsLessThan2 )
97+ . Concat ( Methods . PrimeCalculator . GetUpperBound )
98+ . Concat ( Methods . SampleStruct )
99+ . Append ( Methods . get_Commands ) ) ;
100+ }
101+
71102
72103 [ TestCleanup ]
73104 public void ExitApp ( )
@@ -90,12 +121,12 @@ private void AssertVisitedFilesAndMethods(
90121 private static void ShouldVisit ( IReadOnlyList < string > expectedNames , IReadOnlyList < string > actualNames , string what )
91122 {
92123 Assert . AreEqual ( expectedNames . Count , actualNames . Count , $ "visited { what } s") ;
93- foreach ( var expected in expectedNames )
124+ foreach ( var expected in expectedNames )
94125 {
95126 bool found = false ;
96- foreach ( var actual in actualNames )
127+ foreach ( var actual in actualNames )
97128 {
98- if ( actual . EndsWith ( expected ) )
129+ if ( actual . EndsWith ( expected ) )
99130 {
100131 found = true ;
101132 break ;
@@ -123,16 +154,19 @@ private static class Files
123154
124155 private static class Methods
125156 {
157+ public static string get_Commands = "App::get_Commands()" ;
158+
126159 public static readonly IEnumerable < string > Startup = new string [ ]
127160 {
128161 "Program::Main(System.String[])" ,
129162 "App::.ctor()" ,
130- "App:: get_Commands()" ,
163+ get_Commands ,
131164 "App::Run(System.String[])" ,
132165 "Command::.ctor(System.String,System.String,System.Action`1<System.String>)" ,
133166 "Command::get_Help()" ,
134167 } ;
135168
169+
136170 public static readonly IEnumerable < string > RunCommand = new string [ ]
137171 {
138172 "App::RunCommand(System.String[])" ,
0 commit comments