public void TaskExceptionReturnsError() { var mapper = new TelegramBotMapper(new TelegramBotClient(ApiKey), this.responseFactory); var result = mapper.ProxyCall(this.ThrowingTaskAsync()); var errorResponse = JsonConvert.DeserializeObject <Response <Error> >(result); Assert.Equal(typeof(AccessViolationException).Name, errorResponse.Content.ExceptionType); }
public void LongRunningTaskGetsCancelled() { var mapper = new TelegramBotMapper(new TelegramBotClient(ApiKey), this.responseFactory); var cts = new CancellationTokenSource(1000); var result = mapper.ProxyCall(this.LongRunningTaskAsync(cts.Token)); var errorResponse = JsonConvert.DeserializeObject <Response <Error> >(result); Assert.Equal(typeof(OperationCanceledException).Name, errorResponse.Content.ExceptionType); }