10
10
11
11
namespace Tests . ConnectionTests ;
12
12
13
- public class AnonymousConnectionTests ( ITestOutputHelper testOutputHelper )
13
+ public class SaslConnectionTests ( ITestOutputHelper testOutputHelper )
14
14
: IntegrationTest ( testOutputHelper , setupConnectionAndManagement : false )
15
15
{
16
16
[ Fact ]
17
- public async Task ConnectUsingSaslAnonynmous ( )
17
+ public async Task ConnectUsingSaslAnonymous ( )
18
18
{
19
19
Assert . Null ( _connection ) ;
20
20
Assert . Null ( _management ) ;
@@ -28,6 +28,30 @@ public async Task ConnectUsingSaslAnonynmous()
28
28
ConnectionSettings connectionSettings = connectionSettingBuilder . Build ( ) ;
29
29
_connection = await AmqpConnection . CreateAsync ( connectionSettings ) ;
30
30
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 ) ;
32
56
}
33
57
}
0 commit comments