当前位置: 首页>>代码示例>>C#>>正文


C# Channel.WaitForStateChangedAsync方法代码示例

本文整理汇总了C#中Grpc.Core.Channel.WaitForStateChangedAsync方法的典型用法代码示例。如果您正苦于以下问题:C# Channel.WaitForStateChangedAsync方法的具体用法?C# Channel.WaitForStateChangedAsync怎么用?C# Channel.WaitForStateChangedAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Grpc.Core.Channel的用法示例。


在下文中一共展示了Channel.WaitForStateChangedAsync方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WaitForStateChangedAsync_InvalidArgument

 public void WaitForStateChangedAsync_InvalidArgument()
 {
     using (var channel = new Channel("localhost", Credentials.Insecure))
     {
         Assert.Throws(typeof(ArgumentException), () => channel.WaitForStateChangedAsync(ChannelState.FatalFailure));
     }
 }
开发者ID:hongweiwang,项目名称:grpc,代码行数:7,代码来源:ChannelTest.cs

示例2: WaitForStateChangedAsync_InvalidArgument

 public void WaitForStateChangedAsync_InvalidArgument()
 {
     var channel = new Channel("localhost", ChannelCredentials.Insecure);
     Assert.ThrowsAsync(typeof(ArgumentException), async () => await channel.WaitForStateChangedAsync(ChannelState.FatalFailure));
     channel.ShutdownAsync().Wait();
 }
开发者ID:rwightman,项目名称:grpc,代码行数:6,代码来源:ChannelTest.cs

示例3: OperationsThrowAfterShutdown

 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());
 }
开发者ID:ConfusedReality,项目名称:pkg_network_grpc,代码行数:8,代码来源:ChannelTest.cs

示例4: ShutdownFinishesWaitForStateChangedAsync

 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;
 }
开发者ID:ConfusedReality,项目名称:pkg_network_grpc,代码行数:8,代码来源:ChannelTest.cs


注:本文中的Grpc.Core.Channel.WaitForStateChangedAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。