예제 #1
0
 public async Task Should_receive_response()
 {
     using (bus.RespondAsync <Request, Response>(x =>
     {
         return(Task.FromResult <Response>(x switch
         {
             BunnyRequest b => new BunnyResponse(b.Id),
             RabbitRequest r => new RabbitResponse(r.Id),
             _ => throw new ArgumentOutOfRangeException(nameof(x), x, null)
         }));
     }))
        public async Task Should_receive_response()
        {
            using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));

            using (await bus.Rpc.RespondAsync <Request, Response>(x =>
            {
                return(x switch
                {
                    BunnyRequest b => new BunnyResponse(b.Id),
                    RabbitRequest r => new RabbitResponse(r.Id),
                    _ => throw new ArgumentOutOfRangeException(nameof(x), x, null)
                });
            }, cts.Token))