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 void GetTodaysDate_Returns_formatted_date_in_Portuguese() { // Arrange // Act var todaysDate = PersonalAssistant.GetTodaysDate(); // Assert Assert.NotNull(todaysDate); Assert.NotEmpty(todaysDate); Assert.True(todaysDate.IndexOf("de ") > 0, $"today's date should contain the article 'de'. got this instead: {todaysDate}"); }
public void GetTodaysDate_Returns_formatted_date() { // Arrange // Act var todaysDate = PersonalAssistant.GetTodaysDate(); // Assert Assert.NotNull(todaysDate); Assert.NotEmpty(todaysDate); Assert.True(todaysDate.IndexOf("2020") > 0, "today's date should contain the year 2020"); }