public void TestShutdownAsync_TransportShutdownIsInitiated() { using (var environment = new InProcTestEnvironment()) using (var target = new RpcClient(_loopbackEndPoint, environment.Configuration, null)) { int isShutdownCompleted = 0; target.EnsureConnected(); target.Transport.ShutdownCompleted += (sender, e) => Interlocked.Exchange(ref isShutdownCompleted, 1); using (var task = target.ShutdownAsync()) { Assert.That(target.Transport.IsClientShutdown); Assert.That(task.Wait(TimeSpan.FromSeconds(1))); Assert.That(isShutdownCompleted, Is.EqualTo(1)); } } }
public void TestShutdownAsync_TransportShutdownIsInitiated() { using ( var environment = new InProcTestEnvironment() ) using ( var target = new RpcClient( _loopbackEndPoint, environment.Configuration, null ) ) { int isShutdownCompleted = 0; target.EnsureConnected(); target.Transport.ShutdownCompleted += ( sender, e ) => Interlocked.Exchange( ref isShutdownCompleted, 1 ); using ( var task = target.ShutdownAsync() ) { Assert.That( target.Transport.IsClientShutdown ); Assert.That( task.Wait( TimeSpan.FromSeconds( 1 ) ) ); Assert.That( isShutdownCompleted, Is.EqualTo( 1 ) ); } } }