File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
Tests/HiveMQtt.Test/HiveMQClient Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -4,14 +4,15 @@ namespace HiveMQtt.Test.HiveMQClient;
4
4
using System . Threading . Tasks ;
5
5
using HiveMQtt . Client ;
6
6
using HiveMQtt . Client . Events ;
7
+ using HiveMQtt . Client . Exceptions ;
7
8
using HiveMQtt . Client . Options ;
8
9
using HiveMQtt . MQTT5 . ReasonCodes ;
9
10
using Xunit ;
10
11
11
12
public class ConnectTest
12
13
{
13
14
[ Fact ]
14
- public async Task Basic_Connect_And_Disconnect_Async ( )
15
+ public async Task BasicConnectAndDisconnectAsync ( )
15
16
{
16
17
var client = new HiveMQClient ( ) ;
17
18
Assert . NotNull ( client ) ;
@@ -30,7 +31,20 @@ public async Task Basic_Connect_And_Disconnect_Async()
30
31
}
31
32
32
33
[ Fact ]
33
- public async Task Test_Connect_Events_Async ( )
34
+ public async Task RaiseOnFailureToConnectAsync ( )
35
+ {
36
+ // Bad port number
37
+ var clientOptions = new HiveMQClientOptionsBuilder ( ) . WithPort ( 0 ) . Build ( ) ;
38
+ var client = new HiveMQClient ( clientOptions ) ;
39
+
40
+ await Assert . ThrowsAsync < HiveMQttClientException > ( async ( ) =>
41
+ {
42
+ await client . ConnectAsync ( ) . ConfigureAwait ( false ) ;
43
+ } ) . ConfigureAwait ( false ) ;
44
+ }
45
+
46
+ [ Fact ]
47
+ public async Task TestConnectEventsAsync ( )
34
48
{
35
49
var client = new HiveMQClient ( ) ;
36
50
You can’t perform that action at this time.
0 commit comments