public async Task GetMeAsyncCancellationFlows() { var bot = new BotClientFake(); using var cancellation = new CancellationTokenSource(); cancellation.Cancel(); await bot.Invoking(a => a.GetMeAsync(cancellation.Token)) .Should().ThrowAsync <OperationCanceledException>(); }
public async Task GetMeAsync() { var bot = new BotClientFake(); bot.Handler.Response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent("{}") }; var res = await bot.GetMeAsync(); bot.Handler.Request.Method.Should().Be(HttpMethod.Get); bot.Handler.Request.RequestUri.Should().Be("https://api.telegram.org/bot<token>/getMe"); res.Should().BeEquivalentTo(new Response <User>()); }