@@ -144,8 +144,10 @@ public void ConfigurationAssembliesFromDllScanning()
144
144
Assert . Single ( DummyConsoleSink . Emitted ) ;
145
145
}
146
146
147
- [ Fact ]
148
- public void ConfigurationAssembliesWithInternalMethodInPublicClass ( )
147
+ [ Theory ]
148
+ [ InlineData ( false ) ]
149
+ [ InlineData ( true ) ]
150
+ public void ConfigurationAssembliesWithInternalMethodInPublicClass ( bool allowInternalMethods )
149
151
{
150
152
var json = """
151
153
{
@@ -161,18 +163,23 @@ public void ConfigurationAssembliesWithInternalMethodInPublicClass()
161
163
var log = new LoggerConfiguration ( )
162
164
. ReadFrom . Configuration (
163
165
configuration : config ,
164
- readerOptions : new ConfigurationReaderOptions ( ConfigurationAssemblySource . AlwaysScanDllFiles ) { AllowInternalMethods = true } )
166
+ readerOptions : new ConfigurationReaderOptions ( ConfigurationAssemblySource . AlwaysScanDllFiles ) { AllowInternalMethods = allowInternalMethods } )
165
167
. CreateLogger ( ) ;
166
168
167
169
DummyConsoleSink . Emitted . Clear ( ) ;
168
170
169
171
log . Write ( Some . InformationEvent ( ) ) ;
170
172
171
- Assert . Single ( DummyConsoleSink . Emitted ) ;
173
+ if ( allowInternalMethods )
174
+ Assert . Single ( DummyConsoleSink . Emitted ) ;
175
+ else
176
+ Assert . Empty ( DummyConsoleSink . Emitted ) ;
172
177
}
173
178
174
- [ Fact ]
175
- public void ConfigurationAssembliesWithPublicMethodInInternalClass ( )
179
+ [ Theory ]
180
+ [ InlineData ( false ) ]
181
+ [ InlineData ( true ) ]
182
+ public void ConfigurationAssembliesWithPublicMethodInInternalClass ( bool allowInternalTypes )
176
183
{
177
184
var json = """
178
185
{
@@ -188,18 +195,23 @@ public void ConfigurationAssembliesWithPublicMethodInInternalClass()
188
195
var log = new LoggerConfiguration ( )
189
196
. ReadFrom . Configuration (
190
197
configuration : config ,
191
- readerOptions : new ConfigurationReaderOptions ( ConfigurationAssemblySource . AlwaysScanDllFiles ) { AllowInternalTypes = true } )
198
+ readerOptions : new ConfigurationReaderOptions ( ConfigurationAssemblySource . AlwaysScanDllFiles ) { AllowInternalTypes = allowInternalTypes } )
192
199
. CreateLogger ( ) ;
193
200
194
201
DummyConsoleSink . Emitted . Clear ( ) ;
195
202
196
203
log . Write ( Some . InformationEvent ( ) ) ;
197
204
198
- Assert . Single ( DummyConsoleSink . Emitted ) ;
205
+ if ( allowInternalTypes )
206
+ Assert . Single ( DummyConsoleSink . Emitted ) ;
207
+ else
208
+ Assert . Empty ( DummyConsoleSink . Emitted ) ;
199
209
}
200
210
201
- [ Fact ]
202
- public void ConfigurationAssembliesWithInternalMethodInInternalClass ( )
211
+ [ Theory ]
212
+ [ InlineData ( false , false ) ]
213
+ [ InlineData ( true , true ) ]
214
+ public void ConfigurationAssembliesWithInternalMethodInInternalClass ( bool allowInternalTypes , bool allowInternalMethods )
203
215
{
204
216
var json = """
205
217
{
@@ -215,14 +227,17 @@ public void ConfigurationAssembliesWithInternalMethodInInternalClass()
215
227
var log = new LoggerConfiguration ( )
216
228
. ReadFrom . Configuration (
217
229
configuration : config ,
218
- readerOptions : new ConfigurationReaderOptions ( ConfigurationAssemblySource . AlwaysScanDllFiles ) { AllowInternalTypes = true , AllowInternalMethods = true } )
230
+ readerOptions : new ConfigurationReaderOptions ( ConfigurationAssemblySource . AlwaysScanDllFiles ) { AllowInternalTypes = allowInternalTypes , AllowInternalMethods = allowInternalMethods } )
219
231
. CreateLogger ( ) ;
220
232
221
233
DummyConsoleSink . Emitted . Clear ( ) ;
222
234
223
235
log . Write ( Some . InformationEvent ( ) ) ;
224
236
225
- Assert . Single ( DummyConsoleSink . Emitted ) ;
237
+ if ( allowInternalTypes && allowInternalMethods )
238
+ Assert . Single ( DummyConsoleSink . Emitted ) ;
239
+ else
240
+ Assert . Empty ( DummyConsoleSink . Emitted ) ;
226
241
}
227
242
228
243
[ Fact ]
0 commit comments