File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed
iothub/service/src/Messaging Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 33
44using System ;
55using System . Diagnostics ;
6- using System . Diagnostics . Tracing ;
76using System . Text ;
87using System . Threading . Tasks ;
98using FluentAssertions ;
@@ -87,6 +86,20 @@ public async Task ServiceClient_SendsMessage(TransportType transportType)
8786 await sender . SendAsync ( testDevice . Id , message ) . ConfigureAwait ( false ) ;
8887 }
8988
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+
90103 // Unfortunately, the way AmqpServiceClient is implemented, it makes mocking the required amqp types difficult
91104 // (the amqp types are private members of the class, and cannot be set from any public/ internal API).
92105 // 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 1010using Microsoft . Azure . Amqp ;
1111using Microsoft . Azure . Amqp . Framing ;
1212using Microsoft . Azure . Devices . Common ;
13- using Microsoft . Azure . Devices . Common . Data ;
1413using Microsoft . Azure . Devices . Common . Exceptions ;
1514using Microsoft . Azure . Devices . Shared ;
1615
@@ -290,9 +289,7 @@ public virtual async Task OpenAsync()
290289 if ( Logging . IsEnabled )
291290 Logging . Enter ( this , $ "Opening AmqpServiceClient", nameof ( OpenAsync ) ) ;
292291
293- using var ctx = new CancellationTokenSource ( _openTimeout ) ;
294-
295- await _faultTolerantSendingLink . OpenAsync ( ctx . Token ) . ConfigureAwait ( false ) ;
292+ await _faultTolerantSendingLink . OpenAsync ( _openTimeout ) . ConfigureAwait ( false ) ;
296293 await _feedbackReceiver . OpenAsync ( ) . ConfigureAwait ( false ) ;
297294
298295 if ( Logging . IsEnabled )
You can’t perform that action at this time.
0 commit comments