1010
1111namespace Tests . ConnectionTests ;
1212
13- public class AnonymousConnectionTests ( ITestOutputHelper testOutputHelper )
13+ public class SaslConnectionTests ( ITestOutputHelper testOutputHelper )
1414 : IntegrationTest ( testOutputHelper , setupConnectionAndManagement : false )
1515{
1616 [ Fact ]
17- public async Task ConnectUsingSaslAnonynmous ( )
17+ public async Task ConnectUsingSaslAnonymous ( )
1818 {
1919 Assert . Null ( _connection ) ;
2020 Assert . Null ( _management ) ;
@@ -28,6 +28,30 @@ public async Task ConnectUsingSaslAnonynmous()
2828 ConnectionSettings connectionSettings = connectionSettingBuilder . Build ( ) ;
2929 _connection = await AmqpConnection . CreateAsync ( connectionSettings ) ;
3030
31- Assert . True ( _connection . State == State . Open ) ;
31+ Assert . Equal ( State . Open , _connection . State ) ;
32+
33+ await _connection . CloseAsync ( ) ;
34+ Assert . Equal ( State . Closed , _connection . State ) ;
35+ }
36+
37+ [ Fact ]
38+ public async Task ConnectUsingSaslPlain ( )
39+ {
40+ Assert . Null ( _connection ) ;
41+ Assert . Null ( _management ) ;
42+
43+ ConnectionSettingBuilder connectionSettingBuilder = ConnectionSettingBuilder . Create ( ) ;
44+
45+ _containerId = $ "{ _testDisplayName } :{ Now } ";
46+ connectionSettingBuilder . ContainerId ( _containerId ) ;
47+ connectionSettingBuilder . SaslMechanism ( SaslMechanism . Plain ) ;
48+
49+ ConnectionSettings connectionSettings = connectionSettingBuilder . Build ( ) ;
50+ _connection = await AmqpConnection . CreateAsync ( connectionSettings ) ;
51+
52+ Assert . Equal ( State . Open , _connection . State ) ;
53+
54+ await _connection . CloseAsync ( ) ;
55+ Assert . Equal ( State . Closed , _connection . State ) ;
3256 }
3357}
0 commit comments