11// ReSharper disable InconsistentNaming
22// ReSharper disable NotAccessedPositionalProperty.Global
33// ReSharper disable InconsistentNaming
4+
45namespace HostApi ;
56
67using JetBrains . TeamCity . ServiceMessages ;
@@ -45,18 +46,18 @@ public record BuildMessage(
4546 /// <summary>
4647 /// Contains the result of test execution when <see cref="State"/> is set to <see cref="BuildMessageState.TestResult"/>.
4748 /// </summary>
48- public TestResult ? TestResult =>
49+ public TestResult ? TestResult =>
4950 ServiceMessage != null && TryGetTestState ( ServiceMessage . Name , out var testState )
5051 ? CreateResult ( CreateKey ( ServiceMessage ) , ServiceMessage , testState )
5152 : default ( TestResult ? ) ;
5253
5354 /// <inheritdoc />
5455 public override string ToString ( ) => Text ;
55-
56+
5657 internal static TestResult CreateResult ( TestKey key , IServiceMessage message , TestState state )
5758 {
5859 var testSource = message . GetValue ( "testSource" ) ?? string . Empty ;
59- var displayName = message . GetValue ( "displayName" ) ?? string . Empty ;
60+ var displayName = message . GetValue ( "displayName" ) ?? string . Empty ;
6061 var resultDisplayName = message . GetValue ( "resultDisplayName" ) ?? string . Empty ;
6162 var codeFilePath = message . GetValue ( "codeFilePath" ) ?? string . Empty ;
6263 var fullyQualifiedName = message . GetValue ( "fullyQualifiedName" ) ?? string . Empty ;
@@ -69,7 +70,7 @@ internal static TestResult CreateResult(TestKey key, IServiceMessage message, Te
6970 . WithResultDisplayName ( resultDisplayName )
7071 . WithCodeFilePath ( codeFilePath )
7172 . WithFullyQualifiedName ( fullyQualifiedName ) ;
72-
73+
7374 if ( Guid . TryParse ( message . GetValue ( "id" ) , out var id ) )
7475 {
7576 result = result . WithId ( id ) ;
@@ -84,30 +85,30 @@ internal static TestResult CreateResult(TestKey key, IServiceMessage message, Te
8485 {
8586 result = result . WithLineNumber ( lineNumber ) ;
8687 }
87-
88+
8889 return result ;
8990 }
9091
9192 internal static TestKey CreateKey ( IServiceMessage message )
9293 {
9394 var flowId = message . GetValue ( "flowId" ) ?? string . Empty ;
94- var suiteName = message . GetValue ( "suiteName" ) ?? string . Empty ;
95+ var suiteName = message . GetValue ( "suiteName" ) ?? string . Empty ;
9596 var name = message . GetValue ( "name" ) ?? string . Empty ;
9697 return new TestKey ( flowId , suiteName , name ) ;
9798 }
9899
99100 private static bool TryGetTestState ( string ? name , out TestState state )
100101 {
101- switch ( name ? . ToLowerInvariant ( ) )
102+ switch ( name ? . ToLowerInvariant ( ) )
102103 {
103104 case "testfinished" :
104105 state = TestState . Finished ;
105106 return true ;
106-
107+
107108 case "testignored" :
108109 state = TestState . Ignored ;
109110 return true ;
110-
111+
111112 case "testfailed" :
112113 state = TestState . Failed ;
113114 return true ;
@@ -116,7 +117,7 @@ private static bool TryGetTestState(string? name, out TestState state)
116117 state = default ;
117118 return false ;
118119 }
119-
120+
120121 // ReSharper disable once NotAccessedPositionalProperty.Local
121122 internal readonly record struct TestKey ( string FlowId , string SuiteName , string TestName ) ;
122123}
0 commit comments