@@ -144,8 +144,10 @@ public void ConfigurationAssembliesFromDllScanning()
144144 Assert . Single ( DummyConsoleSink . Emitted ) ;
145145 }
146146
147- [ Fact ]
148- public void ConfigurationAssembliesWithInternalMethodInPublicClass ( )
147+ [ Theory ]
148+ [ InlineData ( false ) ]
149+ [ InlineData ( true ) ]
150+ public void ConfigurationAssembliesWithInternalMethodInPublicClass ( bool allowInternalMethods )
149151 {
150152 var json = """
151153 {
@@ -161,18 +163,23 @@ public void ConfigurationAssembliesWithInternalMethodInPublicClass()
161163 var log = new LoggerConfiguration ( )
162164 . ReadFrom . Configuration (
163165 configuration : config ,
164- readerOptions : new ConfigurationReaderOptions ( ConfigurationAssemblySource . AlwaysScanDllFiles ) { AllowInternalMethods = true } )
166+ readerOptions : new ConfigurationReaderOptions ( ConfigurationAssemblySource . AlwaysScanDllFiles ) { AllowInternalMethods = allowInternalMethods } )
165167 . CreateLogger ( ) ;
166168
167169 DummyConsoleSink . Emitted . Clear ( ) ;
168170
169171 log . Write ( Some . InformationEvent ( ) ) ;
170172
171- Assert . Single ( DummyConsoleSink . Emitted ) ;
173+ if ( allowInternalMethods )
174+ Assert . Single ( DummyConsoleSink . Emitted ) ;
175+ else
176+ Assert . Empty ( DummyConsoleSink . Emitted ) ;
172177 }
173178
174- [ Fact ]
175- public void ConfigurationAssembliesWithPublicMethodInInternalClass ( )
179+ [ Theory ]
180+ [ InlineData ( false ) ]
181+ [ InlineData ( true ) ]
182+ public void ConfigurationAssembliesWithPublicMethodInInternalClass ( bool allowInternalTypes )
176183 {
177184 var json = """
178185 {
@@ -188,18 +195,23 @@ public void ConfigurationAssembliesWithPublicMethodInInternalClass()
188195 var log = new LoggerConfiguration ( )
189196 . ReadFrom . Configuration (
190197 configuration : config ,
191- readerOptions : new ConfigurationReaderOptions ( ConfigurationAssemblySource . AlwaysScanDllFiles ) { AllowInternalTypes = true } )
198+ readerOptions : new ConfigurationReaderOptions ( ConfigurationAssemblySource . AlwaysScanDllFiles ) { AllowInternalTypes = allowInternalTypes } )
192199 . CreateLogger ( ) ;
193200
194201 DummyConsoleSink . Emitted . Clear ( ) ;
195202
196203 log . Write ( Some . InformationEvent ( ) ) ;
197204
198- Assert . Single ( DummyConsoleSink . Emitted ) ;
205+ if ( allowInternalTypes )
206+ Assert . Single ( DummyConsoleSink . Emitted ) ;
207+ else
208+ Assert . Empty ( DummyConsoleSink . Emitted ) ;
199209 }
200210
201- [ Fact ]
202- public void ConfigurationAssembliesWithInternalMethodInInternalClass ( )
211+ [ Theory ]
212+ [ InlineData ( false , false ) ]
213+ [ InlineData ( true , true ) ]
214+ public void ConfigurationAssembliesWithInternalMethodInInternalClass ( bool allowInternalTypes , bool allowInternalMethods )
203215 {
204216 var json = """
205217 {
@@ -215,14 +227,17 @@ public void ConfigurationAssembliesWithInternalMethodInInternalClass()
215227 var log = new LoggerConfiguration ( )
216228 . ReadFrom . Configuration (
217229 configuration : config ,
218- readerOptions : new ConfigurationReaderOptions ( ConfigurationAssemblySource . AlwaysScanDllFiles ) { AllowInternalTypes = true , AllowInternalMethods = true } )
230+ readerOptions : new ConfigurationReaderOptions ( ConfigurationAssemblySource . AlwaysScanDllFiles ) { AllowInternalTypes = allowInternalTypes , AllowInternalMethods = allowInternalMethods } )
219231 . CreateLogger ( ) ;
220232
221233 DummyConsoleSink . Emitted . Clear ( ) ;
222234
223235 log . Write ( Some . InformationEvent ( ) ) ;
224236
225- Assert . Single ( DummyConsoleSink . Emitted ) ;
237+ if ( allowInternalTypes && allowInternalMethods )
238+ Assert . Single ( DummyConsoleSink . Emitted ) ;
239+ else
240+ Assert . Empty ( DummyConsoleSink . Emitted ) ;
226241 }
227242
228243 [ Fact ]
0 commit comments