File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ using Microsoft . VisualStudio . TestTools . UnitTesting ;
2+ using NetSdrClient . Services ;
3+
4+ namespace NetSdrClient . Tests
5+ {
6+ [ TestClass ]
7+ public class ProtocolHandlerTests
8+ {
9+ [ TestMethod ]
10+ public void ProtocolHandler_Constructor_ShouldInitialize ( )
11+ {
12+ // Arrange & Act
13+ var handler = new ProtocolHandler ( ) ;
14+
15+ // Assert
16+ Assert . IsNotNull ( handler ) ;
17+ }
18+
19+ [ TestMethod ]
20+ public void CreateCommand_ShouldReturnValidCommand ( )
21+ {
22+ // Arrange
23+ var handler = new ProtocolHandler ( ) ;
24+ var expectedCommand = "CONNECT" ;
25+
26+ // Act
27+ var result = handler . CreateCommand ( expectedCommand ) ;
28+
29+ // Assert
30+ Assert . IsNotNull ( result ) ;
31+ Assert . IsTrue ( result . Contains ( expectedCommand ) ) ;
32+ }
33+
34+ [ TestMethod ]
35+ public void ParseResponse_WithValidData_ShouldReturnParsedResponse ( )
36+ {
37+ // Arrange
38+ var handler = new ProtocolHandler ( ) ;
39+ var testData = "OK:CONNECTED" ;
40+
41+ // Act
42+ var result = handler . ParseResponse ( testData ) ;
43+
44+ // Assert
45+ Assert . IsNotNull ( result ) ;
46+ Assert . IsTrue ( result . Contains ( "CONNECTED" ) ) ;
47+ }
48+
49+ [ TestMethod ]
50+ public void ParseResponse_WithNullData_ShouldReturnErrorMessage ( )
51+ {
52+ // Arrange
53+ var handler = new ProtocolHandler ( ) ;
54+
55+ // Act
56+ var result = handler . ParseResponse ( null ) ;
57+
58+ // Assert
59+ Assert . IsNotNull ( result ) ;
60+ Assert . IsTrue ( result . Contains ( "ERROR" ) ) ;
61+ }
62+ }
63+ }
You can’t perform that action at this time.
0 commit comments