1- using AwesomeAssertions ;
2- using AwesomeAssertions . Execution ;
1+ using TUnit . Assertions ;
32
43namespace TrxLib . Tests ;
54
@@ -9,77 +8,76 @@ public class TestResultTests
98 [ Arguments ( "namespace.class.test" , "namespace" ) ]
109 [ Arguments ( "deeper.namespace.class.test" , "deeper.namespace" ) ]
1110 [ Arguments ( "still.deeper.namespace.class.test" , "still.deeper.namespace" ) ]
12- public void Namespace_is_parsed_correctly (
11+ public async Task Namespace_is_parsed_correctly (
1312 string fullyQualifiedTestName ,
1413 string expectedNamespace )
1514 {
1615 var testResult = new TestResult ( fullyQualifiedTestName , TestOutcome . NotExecuted ) ;
17- testResult . Namespace . Should ( ) . Be ( expectedNamespace ) ;
16+ await Assert . That ( testResult . Namespace ) . IsEqualTo ( expectedNamespace ) ;
1817 }
1918
2019 [ Test ]
2120 [ Arguments ( "namespace.class.test" ) ]
2221 [ Arguments ( "deeper.namespace.class.test" ) ]
2322 [ Arguments ( "still.deeper.namespace.class.test" ) ]
24- public void TestName_is_parsed_correctly (
23+ public async Task TestName_is_parsed_correctly (
2524 string fullyQualifiedTestName )
2625 {
2726 var testResult = new TestResult ( fullyQualifiedTestName , TestOutcome . NotExecuted ) ;
28- testResult . TestName . Should ( ) . Be ( "test" ) ;
27+ await Assert . That ( testResult . TestName ) . IsEqualTo ( "test" ) ;
2928 }
3029
3130 [ Test ]
3231 [ Arguments ( "namespace.class.test" ) ]
3332 [ Arguments ( "deeper.namespace.class.test" ) ]
3433 [ Arguments ( "still.deeper.namespace.class.test" ) ]
35- public void ClassName_is_parsed_correctly (
34+ public async Task ClassName_is_parsed_correctly (
3635 string fullyQualifiedTestName )
3736 {
3837 var testResult = new TestResult ( fullyQualifiedTestName , TestOutcome . NotExecuted ) ;
39- testResult . ClassName . Should ( ) . Be ( "class" ) ;
38+ await Assert . That ( testResult . ClassName ) . IsEqualTo ( "class" ) ;
4039 }
4140
4241 [ Test ]
4342 [ Arguments ( "namespace.class.test" , "namespace.class" ) ]
4443 [ Arguments ( "deeper.namespace.class.test" , "deeper.namespace.class" ) ]
4544 [ Arguments ( "still.deeper.namespace.class.test" , "still.deeper.namespace.class" ) ]
4645 [ Arguments ( "deeper.namespace.class.theorytest(command: \" build\" )" , "deeper.namespace.class" ) ]
47- public void FullyQualifiedClassName_is_parsed_correctly (
46+ public async Task FullyQualifiedClassName_is_parsed_correctly (
4847 string fullyQualifiedTestName ,
4948 string expected )
5049 {
5150 var testResult = new TestResult ( fullyQualifiedTestName , TestOutcome . NotExecuted ) ;
52- testResult . FullyQualifiedClassName . Should ( ) . Be ( expected ) ;
51+ await Assert . That ( testResult . FullyQualifiedClassName ) . IsEqualTo ( expected ) ;
5352 }
5453
5554 [ Test ]
56- public void Theory_test_is_parsed_correctly ( )
55+ public async Task Theory_test_is_parsed_correctly ( )
5756 {
5857 var testResult = new TestResult (
5958 "Microsoft.DotNet.Cli.MSBuild.IntegrationTests.GivenDotnetInvokesMSBuild.When_dotnet_command_invokes_msbuild_Then_env_vars_and_m_are_passed(command: \" build\" )" ,
6059 outcome : TestOutcome . Passed ) ;
6160
62- using var _ = new AssertionScope ( ) ;
63- testResult . TestName . Should ( ) . Be ( "When_dotnet_command_invokes_msbuild_Then_env_vars_and_m_are_passed(command: \" build\" )" ) ;
64- testResult . Namespace . Should ( ) . Be ( "Microsoft.DotNet.Cli.MSBuild.IntegrationTests" ) ;
65- testResult . ClassName . Should ( ) . Be ( "GivenDotnetInvokesMSBuild" ) ;
61+ await Assert . That ( testResult . TestName ) . IsEqualTo ( "When_dotnet_command_invokes_msbuild_Then_env_vars_and_m_are_passed(command: \" build\" )" ) ;
62+ await Assert . That ( testResult . Namespace ) . IsEqualTo ( "Microsoft.DotNet.Cli.MSBuild.IntegrationTests" ) ;
63+ await Assert . That ( testResult . ClassName ) . IsEqualTo ( "GivenDotnetInvokesMSBuild" ) ;
6664 }
6765
6866 [ Test ]
6967 [ Arguments ( "Cell 1: #r \" nuget:TRexLib\" " ) ]
7068 [ Arguments ( "Cell 1: Console.Write(\" Hello world.\" ;" ) ]
71- public void Inferred_properties_are_not_inferred_from_fully_qualified_test_name_if_they_do_not_match_dotnet_standards (
69+ public async Task Inferred_properties_are_not_inferred_from_fully_qualified_test_name_if_they_do_not_match_dotnet_standards (
7270 string fullyQualifiedTestName )
7371 {
7472 var testResult = new TestResult ( fullyQualifiedTestName , TestOutcome . NotExecuted ) ;
75- testResult . ClassName . Should ( ) . BeNull ( ) ;
76- testResult . FullyQualifiedClassName . Should ( ) . BeNull ( ) ;
77- testResult . Namespace . Should ( ) . BeNull ( ) ;
78- testResult . TestName . Should ( ) . Be ( fullyQualifiedTestName ) ;
73+ await Assert . That ( testResult . ClassName ) . IsNull ( ) ;
74+ await Assert . That ( testResult . FullyQualifiedClassName ) . IsNull ( ) ;
75+ await Assert . That ( testResult . Namespace ) . IsNull ( ) ;
76+ await Assert . That ( testResult . TestName ) . IsEqualTo ( fullyQualifiedTestName ) ;
7977 }
8078
8179 [ Test ]
82- public void Theory_test_with_dotted_param_is_parsed_correctly_when_testMethod_provided ( )
80+ public async Task Theory_test_with_dotted_param_is_parsed_correctly_when_testMethod_provided ( )
8381 {
8482 // When testMethod is supplied the constructor must use testMethod.ClassName
8583 // directly instead of splitting the FQTN on '.'. Without the fix, a param
@@ -91,22 +89,20 @@ public void Theory_test_with_dotted_param_is_parsed_correctly_when_testMethod_pr
9189 var testResult = new TestResult ( fqtn , TestOutcome . Passed ,
9290 testMethod : new TestMethod { ClassName = className , Name = methodName } ) ;
9391
94- using var _ = new AssertionScope ( ) ;
95- testResult . FullyQualifiedTestName . Should ( ) . Be ( fqtn ) ;
96- testResult . FullyQualifiedClassName . Should ( ) . Be ( className ) ;
97- testResult . ClassName . Should ( ) . Be ( "ParserTests" ) ;
98- testResult . Namespace . Should ( ) . Be ( "System.CommandLine.Tests" ) ;
99- testResult . TestName . Should ( ) . Be ( $ "{ methodName } (param: \" foo.bar\" )") ;
92+ await Assert . That ( testResult . FullyQualifiedTestName ) . IsEqualTo ( fqtn ) ;
93+ await Assert . That ( testResult . FullyQualifiedClassName ) . IsEqualTo ( className ) ;
94+ await Assert . That ( testResult . ClassName ) . IsEqualTo ( "ParserTests" ) ;
95+ await Assert . That ( testResult . Namespace ) . IsEqualTo ( "System.CommandLine.Tests" ) ;
96+ await Assert . That ( testResult . TestName ) . IsEqualTo ( $ "{ methodName } (param: \" foo.bar\" )") ;
10097 }
10198
10299 [ Test ]
103- public void ToString_DoesNotThrow_ForOutcomeValueNotInEnum ( )
100+ public async Task ToString_DoesNotThrow_ForOutcomeValueNotInEnum ( )
104101 {
105102 // TestResult.ToString() has a _ => throw arm that crashes on any enum value
106103 // not listed in its switch expression (e.g. future additions to TestOutcome, or
107104 // values written by vstest that TrxLib doesn't yet map, such as "Completed").
108105 var testResult = new TestResult ( "some.namespace.SomeClass.SomeTest" , ( TestOutcome ) 99 ) ;
109- var act = ( ) => testResult . ToString ( ) ;
110- act . Should ( ) . NotThrow < ArgumentOutOfRangeException > ( ) ;
106+ await Assert . That ( ( ) => testResult . ToString ( ) ) . ThrowsNothing ( ) ;
111107 }
112- }
108+ }
0 commit comments