@@ -10,7 +10,7 @@ public void CreateAgentString_ReturnsBase64EncodedJson_With_Correct_Name_And_Ver
1010 var agentString = Utils . CreateAgentString ( ) ;
1111 var decoded = Encoding . UTF8 . GetString ( Convert . FromBase64String ( agentString ) ) ;
1212 decoded . Should ( ) . Contain ( "\" name\" :\" aspnetcore-api\" " ) ;
13- decoded . Should ( ) . MatchRegex ( "\" version\" :\" \\ d+ \\ . \\ d+ \\ . \\ d+ \" " ) ;
13+ decoded . Should ( ) . Contain ( $ "\" version\" :\" { Version . Current } \" ") ;
1414 }
1515
1616 [ Fact ]
@@ -20,29 +20,4 @@ public void CreateAgentString_Returns_Valid_Base64_String()
2020 Action act = ( ) => Convert . FromBase64String ( agentString ) ;
2121 act . Should ( ) . NotThrow ( ) ;
2222 }
23-
24- [ Fact ]
25- public void CreateAgentString_Returns_Json_With_Default_Version_If_Assembly_Version_Is_Null ( )
26- {
27- // Simulate null version by using a test double if possible, otherwise check for "0.0.0" fallback
28- // Since static method and type, we can only check for the fallback value in the output
29- var agentString = Utils . CreateAgentString ( ) ;
30- var decoded = Encoding . UTF8 . GetString ( Convert . FromBase64String ( agentString ) ) ;
31- decoded . Should ( ) . MatchRegex ( "\" version\" :\" \\ d+\\ .\\ d+\\ .\\ d+\" " ) ;
32- }
33-
34- [ Fact ]
35- public void BuildVersionString_ReturnsCorrectString_When_Version_Is_Not_Null ( )
36- {
37- var version = new Version ( 1 , 2 , 3 ) ;
38- var result = Utils . BuildVersionString ( version ) ;
39- result . Should ( ) . Be ( "1.2.3" ) ;
40- }
41-
42- [ Fact ]
43- public void BuildVersionString_Returns_Zero_Version_When_Version_Is_Null ( )
44- {
45- var result = Utils . BuildVersionString ( null ) ;
46- result . Should ( ) . Be ( "0.0.0" ) ;
47- }
4823}
0 commit comments