コード例 #1
0
ファイル: ChannelTest.cs プロジェクト: hongweiwang/grpc
 public void WaitForStateChangedAsync_InvalidArgument()
 {
     using (var channel = new Channel("localhost", Credentials.Insecure))
     {
         Assert.Throws(typeof(ArgumentException), () => channel.WaitForStateChangedAsync(ChannelState.FatalFailure));
     }
 }
コード例 #2
0
ファイル: ChannelTest.cs プロジェクト: rwightman/grpc
 public void WaitForStateChangedAsync_InvalidArgument()
 {
     var channel = new Channel("localhost", ChannelCredentials.Insecure);
     Assert.ThrowsAsync(typeof(ArgumentException), async () => await channel.WaitForStateChangedAsync(ChannelState.FatalFailure));
     channel.ShutdownAsync().Wait();
 }
コード例 #3
0
 public async Task OperationsThrowAfterShutdown()
 {
     var channel = new Channel("localhost", ChannelCredentials.Insecure);
     await channel.ShutdownAsync();
     Assert.ThrowsAsync(typeof(ObjectDisposedException), async () => await channel.WaitForStateChangedAsync(ChannelState.Idle));
     Assert.Throws(typeof(ObjectDisposedException), () => { var x = channel.ResolvedTarget; });
     Assert.ThrowsAsync(typeof(TaskCanceledException), async () => await channel.ConnectAsync());
 }
コード例 #4
0
 public async Task ShutdownFinishesWaitForStateChangedAsync()
 {
     var channel = new Channel("localhost", ChannelCredentials.Insecure);
     var stateChangedTask = channel.WaitForStateChangedAsync(ChannelState.Idle);
     var shutdownTask = channel.ShutdownAsync();
     await stateChangedTask;
     await shutdownTask;
 }