@@ -43,13 +43,13 @@ public XUnit2MTPTestFramework(
4343 _logger = loggerFactory . CreateLogger < XUnit2MTPTestFramework > ( ) ;
4444 }
4545
46- public string Uid => nameof ( XUnit2MTPTestFramework ) ;
46+ public string Uid => XUnit2MTPExtension . Instance . Uid ;
4747
48- public string Version => "1.0.0" ;
48+ public string Version => XUnit2MTPExtension . Instance . Version ;
4949
50- public string DisplayName => "XUnit 2 Microsoft.Testing.Platform adapter" ;
50+ public string DisplayName => XUnit2MTPExtension . Instance . DisplayName ;
5151
52- public string Description => DisplayName ;
52+ public string Description => XUnit2MTPExtension . Instance . Description ;
5353
5454 public Type [ ] DataTypesProduced { get ; } =
5555 [
@@ -241,10 +241,36 @@ private static bool MatchesFilter(ITestExecutionFilter mtpFilter, TestCaseFilter
241241 {
242242#pragma warning disable TPEXP // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
243243 null or NopFilter => true ,
244+ TreeNodeFilter treeNodeFilter => treeNodeFilter . MatchesFilter ( CreateNodePath ( test ) , CreateFilterablePropertyBag ( test ) ) ,
244245#pragma warning restore TPEXP // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
245- TestNodeUidListFilter testNodeUidListFilter => testNodeUidListFilter . TestNodeUids . Contains ( new TestNodeUid ( test . UniqueID ) ) ,
246+ TestNodeUidListFilter testNodeUidListFilter => testNodeUidListFilter . TestNodeUids . Contains ( new TestNodeUid ( test . UniqueID ) ) ,
246247 _ => throw new NotSupportedException ( $ "Filter type '{ mtpFilter . GetType ( ) . FullName } ' is not supported by XUnit2 MTP adapter.") ,
247248 } ;
249+
250+ static string CreateNodePath ( ITestCase testCase )
251+ {
252+ var assemblyName = testCase . TestMethod . TestClass . Class . Assembly . SimpleAssemblyName ( ) ;
253+ var fqn = testCase . TestMethod . TestClass . Class . Name ;
254+ var lastDotIndex = fqn . LastIndexOf ( '.' ) ;
255+ var namespaceName = lastDotIndex >= 0 ? fqn . Substring ( 0 , lastDotIndex ) : string . Empty ;
256+ var classTypeName = lastDotIndex >= 0 ? fqn . Substring ( lastDotIndex + 1 ) : fqn ;
257+ var methodName = testCase . TestMethod . Method . Name ;
258+ return $ "/{ assemblyName } /{ namespaceName } /{ classTypeName } /{ methodName } ";
259+ }
260+
261+ static PropertyBag CreateFilterablePropertyBag ( ITestCase testCase )
262+ {
263+ var propertyBag = new PropertyBag ( ) ;
264+ foreach ( var trait in testCase . Traits )
265+ {
266+ foreach ( var traitValue in trait . Value )
267+ {
268+ propertyBag . Add ( new TestMetadataProperty ( trait . Key , traitValue ) ) ;
269+ }
270+ }
271+
272+ return propertyBag ;
273+ }
248274 }
249275
250276 private async Task < TestAssemblyConfiguration > GetConfigurationAsync ( string assemblyPath , CancellationToken cancellationToken )
0 commit comments