File tree 2 files changed +15
-5
lines changed
iothub/service/src/Messaging
2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 3
3
4
4
using System ;
5
5
using System . Diagnostics ;
6
- using System . Diagnostics . Tracing ;
7
6
using System . Text ;
8
7
using System . Threading . Tasks ;
9
8
using FluentAssertions ;
@@ -87,6 +86,20 @@ public async Task ServiceClient_SendsMessage(TransportType transportType)
87
86
await sender . SendAsync ( testDevice . Id , message ) . ConfigureAwait ( false ) ;
88
87
}
89
88
89
+ [ TestMethod ]
90
+ [ Timeout ( TestTimeoutMilliseconds ) ]
91
+ [ DataRow ( TransportType . Amqp ) ]
92
+ [ DataRow ( TransportType . Amqp_WebSocket_Only ) ]
93
+ public async Task ServiceClient_Open ( TransportType transportType )
94
+ {
95
+ // arrange
96
+ using TestDevice testDevice = await TestDevice . GetTestDeviceAsync ( DevicePrefix ) . ConfigureAwait ( false ) ;
97
+ using var client = ServiceClient . CreateFromConnectionString ( TestConfiguration . IotHub . ConnectionString , transportType ) ;
98
+
99
+ // act and expect no exception
100
+ await client . OpenAsync ( ) . ConfigureAwait ( false ) ;
101
+ }
102
+
90
103
// Unfortunately, the way AmqpServiceClient is implemented, it makes mocking the required amqp types difficult
91
104
// (the amqp types are private members of the class, and cannot be set from any public/ internal API).
92
105
// For this reason the following test is tested in the E2E flow, even though this is a unit test scenario.
Original file line number Diff line number Diff line change 10
10
using Microsoft . Azure . Amqp ;
11
11
using Microsoft . Azure . Amqp . Framing ;
12
12
using Microsoft . Azure . Devices . Common ;
13
- using Microsoft . Azure . Devices . Common . Data ;
14
13
using Microsoft . Azure . Devices . Common . Exceptions ;
15
14
using Microsoft . Azure . Devices . Shared ;
16
15
@@ -290,9 +289,7 @@ public virtual async Task OpenAsync()
290
289
if ( Logging . IsEnabled )
291
290
Logging . Enter ( this , $ "Opening AmqpServiceClient", nameof ( OpenAsync ) ) ;
292
291
293
- using var ctx = new CancellationTokenSource ( _openTimeout ) ;
294
-
295
- await _faultTolerantSendingLink . OpenAsync ( ctx . Token ) . ConfigureAwait ( false ) ;
292
+ await _faultTolerantSendingLink . OpenAsync ( _openTimeout ) . ConfigureAwait ( false ) ;
296
293
await _feedbackReceiver . OpenAsync ( ) . ConfigureAwait ( false ) ;
297
294
298
295
if ( Logging . IsEnabled )
You can’t perform that action at this time.
0 commit comments