public async Task PerformLongRunningTaskAsync_if_year_is_2020_Returns_true() { // Arrange httpMessageHandler .Protected() .Setup <Task <HttpResponseMessage> >( "SendAsync", ItExpr.IsAny <HttpRequestMessage>(), ItExpr.IsAny <CancellationToken>()) .ReturnsAsync(new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent("") }); // Act var todaysDate = PersonalAssistant.GetTodaysDate(); bool result; if (todaysDate.Contains("2020")) { result = await personalAssistant.PerformLongRunningTaskAsync(3000); } else { throw new XunitException("Can't perform task because the date is:"); } // Assert Assert.True(result); }
public async Task PerformLongRunningTaskAsync_Returns_true() { // Arrange httpMessageHandler .Protected() .Setup <Task <HttpResponseMessage> >( "SendAsync", ItExpr.IsAny <HttpRequestMessage>(), ItExpr.IsAny <CancellationToken>()) .ReturnsAsync(new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent("") }); // Act var response = await personalAssistant.PerformLongRunningTaskAsync(3000); // Assert Assert.True(response); }