@@ -93,8 +93,8 @@ internal static class NUnitXmlAttributeNames
93
93
94
94
public string AssemblyPath { get ; private set ; }
95
95
96
- IAdapterSettings Settings { get ; }
97
- ITestLogger TestLog { get ; }
96
+ private IAdapterSettings Settings { get ; }
97
+ private ITestLogger TestLog { get ; }
98
98
99
99
public bool NoOfLoadedTestCasesAboveLimit => NoOfLoadedTestCases > Settings . AssemblySelectLimit ;
100
100
public IEnumerable < TestCase > CheckTestCasesExplicit ( IEnumerable < TestCase > filteredTestCases )
@@ -163,15 +163,10 @@ public IList<TestCase> Convert(NUnitResults discoveryResults, string assemblyPat
163
163
timing . LogTime ( "Converting test cases " ) ;
164
164
return loadedTestCases ;
165
165
166
- IEnumerable < NUnitDiscoveryTestCase > RunnableTestCases ( bool isExplicit )
167
- {
168
- IEnumerable < NUnitDiscoveryTestCase > result ;
169
- if ( isExplicit || ! Settings . DesignMode )
170
- result = TestRun . TestAssembly . AllTestCases ;
171
- else
172
- result = TestRun . TestAssembly . RunnableTestCases ;
173
- return result ;
174
- }
166
+ IEnumerable < NUnitDiscoveryTestCase > RunnableTestCases ( bool isExplicit ) =>
167
+ isExplicit || ! Settings . DesignMode
168
+ ? TestRun . TestAssembly . AllTestCases
169
+ : TestRun . TestAssembly . RunnableTestCases ;
175
170
}
176
171
177
172
public NUnitDiscoveryTestRun ConvertXml ( NUnitResults discovery )
@@ -192,11 +187,17 @@ private static NUnitDiscoveryTestSuite ExtractTestSuite(XElement node, NUnitDisc
192
187
return ts ;
193
188
}
194
189
195
- private static void ExtractAllFixtures ( NUnitDiscoveryTestSuite parent , XElement node )
190
+ private void ExtractAllFixtures ( NUnitDiscoveryTestSuite parent , XElement node )
196
191
{
197
192
foreach ( var child in node . Elements ( "test-suite" ) )
198
193
{
199
- var type = child . Attribute ( NUnitXmlAttributeNames . Type ) . Value ;
194
+ var type = child . Attribute ( NUnitXmlAttributeNames . Type ) ? . Value ;
195
+ if ( type == null )
196
+ {
197
+ TestLog . Debug ( $ "ETF1:Don't understand element: { child } ") ;
198
+ continue ;
199
+ }
200
+
200
201
var className = child . Attribute ( NUnitXmlAttributeNames . Classname ) ? . Value ;
201
202
switch ( type )
202
203
{
@@ -233,11 +234,16 @@ private static void ExtractAllFixtures(NUnitDiscoveryTestSuite parent, XElement
233
234
}
234
235
}
235
236
236
- private static void ExtractTestFixtures ( NUnitDiscoveryCanHaveTestFixture parent , XElement node )
237
+ private void ExtractTestFixtures ( NUnitDiscoveryCanHaveTestFixture parent , XElement node )
237
238
{
238
239
foreach ( var child in node . Elements ( ) . Where ( o => o . Name != "properties" ) )
239
240
{
240
- var type = child . Attribute ( NUnitXmlAttributeNames . Type ) . Value ;
241
+ var type = child . Attribute ( NUnitXmlAttributeNames . Type ) ? . Value ;
242
+ if ( type == null )
243
+ {
244
+ TestLog . Debug ( $ "ETF2:Don't understand element: { child } ") ;
245
+ continue ;
246
+ }
241
247
var className = child . Attribute ( NUnitXmlAttributeNames . Classname ) ? . Value ;
242
248
var btf = ExtractSuiteBasePropertiesClass ( child ) ;
243
249
switch ( type )
@@ -366,8 +372,8 @@ private static NUnitDiscoveryParameterizedTestFixture ExtractParameterizedTestFi
366
372
367
373
private NUnitDiscoveryTestAssembly ExtractTestAssembly ( XElement node , NUnitDiscoveryTestRun parent )
368
374
{
369
- string dType = node . Attribute ( NUnitXmlAttributeNames . Type ) . Value ;
370
- if ( dType != "Assembly" )
375
+ string dType = node . Attribute ( NUnitXmlAttributeNames . Type ) ? . Value ;
376
+ if ( dType is not "Assembly" )
371
377
throw new DiscoveryException ( "Node is not of type assembly: " + node ) ;
372
378
var aBase = ExtractSuiteBasePropertiesClass ( node ) ;
373
379
var assembly = new NUnitDiscoveryTestAssembly ( aBase , parent ) ;
0 commit comments