@@ -68,6 +68,37 @@ public void Coverage_IsPrime7()
68
68
. Concat ( Methods . SampleStruct ) ) ;
69
69
}
70
70
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
+
71
102
72
103
[ TestCleanup ]
73
104
public void ExitApp ( )
@@ -90,12 +121,12 @@ private void AssertVisitedFilesAndMethods(
90
121
private static void ShouldVisit ( IReadOnlyList < string > expectedNames , IReadOnlyList < string > actualNames , string what )
91
122
{
92
123
Assert . AreEqual ( expectedNames . Count , actualNames . Count , $ "visited { what } s") ;
93
- foreach ( var expected in expectedNames )
124
+ foreach ( var expected in expectedNames )
94
125
{
95
126
bool found = false ;
96
- foreach ( var actual in actualNames )
127
+ foreach ( var actual in actualNames )
97
128
{
98
- if ( actual . EndsWith ( expected ) )
129
+ if ( actual . EndsWith ( expected ) )
99
130
{
100
131
found = true ;
101
132
break ;
@@ -123,16 +154,19 @@ private static class Files
123
154
124
155
private static class Methods
125
156
{
157
+ public static string get_Commands = "App::get_Commands()" ;
158
+
126
159
public static readonly IEnumerable < string > Startup = new string [ ]
127
160
{
128
161
"Program::Main(System.String[])" ,
129
162
"App::.ctor()" ,
130
- "App:: get_Commands()" ,
163
+ get_Commands ,
131
164
"App::Run(System.String[])" ,
132
165
"Command::.ctor(System.String,System.String,System.Action`1<System.String>)" ,
133
166
"Command::get_Help()" ,
134
167
} ;
135
168
169
+
136
170
public static readonly IEnumerable < string > RunCommand = new string [ ]
137
171
{
138
172
"App::RunCommand(System.String[])" ,
0 commit comments