@@ -42,10 +42,12 @@ public void TestCoreLibInstrumentation()
42
42
Assert . NotNull ( result ) ;
43
43
}
44
44
45
- [ Fact ]
46
- public void TestInstrument ( )
45
+ [ Theory ]
46
+ [ InlineData ( true ) ]
47
+ [ InlineData ( false ) ]
48
+ public void TestInstrument ( bool singleHit )
47
49
{
48
- var instrumenterTest = CreateInstrumentor ( ) ;
50
+ var instrumenterTest = CreateInstrumentor ( singleHit : singleHit ) ;
49
51
50
52
var result = instrumenterTest . Instrumenter . Instrument ( ) ;
51
53
@@ -55,10 +57,12 @@ public void TestInstrument()
55
57
instrumenterTest . Directory . Delete ( true ) ;
56
58
}
57
59
58
- [ Fact ]
59
- public void TestInstrumentCoreLib ( )
60
+ [ Theory ]
61
+ [ InlineData ( true ) ]
62
+ [ InlineData ( false ) ]
63
+ public void TestInstrumentCoreLib ( bool singleHit )
60
64
{
61
- var instrumenterTest = CreateInstrumentor ( fakeCoreLibModule : true ) ;
65
+ var instrumenterTest = CreateInstrumentor ( fakeCoreLibModule : true , singleHit : singleHit ) ;
62
66
63
67
var result = instrumenterTest . Instrumenter . Instrument ( ) ;
64
68
@@ -144,7 +148,7 @@ public void TestInstrument_ClassesWithPropertyWithCustomExcludeAttributeAreExclu
144
148
instrumenterTest . Directory . Delete ( true ) ;
145
149
}
146
150
147
- private InstrumenterTest CreateInstrumentor ( bool fakeCoreLibModule = false , string [ ] attributesToIgnore = null )
151
+ private InstrumenterTest CreateInstrumentor ( bool fakeCoreLibModule = false , string [ ] attributesToIgnore = null , string [ ] excludedFiles = null , bool singleHit = false )
148
152
{
149
153
string module = GetType ( ) . Assembly . Location ;
150
154
string pdb = Path . Combine ( Path . GetDirectoryName ( module ) , Path . GetFileNameWithoutExtension ( module ) + ".pdb" ) ;
@@ -168,7 +172,8 @@ private InstrumenterTest CreateInstrumentor(bool fakeCoreLibModule = false, stri
168
172
File . Copy ( pdb , Path . Combine ( directory . FullName , destPdb ) , true ) ;
169
173
170
174
module = Path . Combine ( directory . FullName , destModule ) ;
171
- Instrumenter instrumenter = new Instrumenter ( module , identifier , Array . Empty < string > ( ) , Array . Empty < string > ( ) , Array . Empty < string > ( ) , attributesToIgnore , false , new Mock < ILogger > ( ) . Object ) ;
175
+ Instrumenter instrumenter = new Instrumenter ( module , identifier , Array . Empty < string > ( ) , Array . Empty < string > ( ) , excludedFiles , attributesToIgnore , singleHit , new Mock < ILogger > ( ) . Object ) ;
176
+
172
177
return new InstrumenterTest
173
178
{
174
179
Instrumenter = instrumenter ,
@@ -253,5 +258,14 @@ public void SkipEmbeddedPpdbWithoutLocalSource()
253
258
loggerMock . VerifyNoOtherCalls ( ) ;
254
259
}
255
260
261
+ [ Fact ]
262
+ public void TestInstrument_MissingModule ( )
263
+ {
264
+ var loggerMock = new Mock < ILogger > ( ) ;
265
+ var instrumenter = new Instrumenter ( "test" , "_test_instrumented" , Array . Empty < string > ( ) , Array . Empty < string > ( ) , Array . Empty < string > ( ) , Array . Empty < string > ( ) , false , loggerMock . Object ) ;
266
+ Assert . False ( instrumenter . CanInstrument ( ) ) ;
267
+ loggerMock . Verify ( l => l . LogWarning ( It . IsAny < string > ( ) ) ) ;
268
+ }
269
+
256
270
}
257
- }
271
+ }
0 commit comments