public async Task Appends_Done_On_Success() { // Arrange var result = new StringBuilder(); var handler = new MockHttpMessageHandler(); var client = new HttpClient(handler); var uri = "https://bfren.dev"; // Act await MenuF.LoadUriAsync(result, client, uri, CancellationToken.None); // Assert Assert.Contains("done", result.ToString()); }
public async Task Appends_Failed_On_Failure() { // Arrange var result = new StringBuilder(); var handler = new MockHttpMessageHandler(System.Net.HttpStatusCode.InternalServerError); var client = new HttpClient(handler); var uri = "https://bfren.dev"; // Act await MenuF.LoadUriAsync(result, client, uri, CancellationToken.None); // Assert Assert.Contains("failed", result.ToString()); }
public async Task Returns_Correct_Message() { // Arrange var result = new StringBuilder(); var handler = new MockHttpMessageHandler(); var client = new HttpClient(handler); var uri = "https://bfren.dev"; var expected = $"Loading {uri} .. done<br/>{Environment.NewLine}"; // Act await MenuF.LoadUriAsync(result, client, uri, CancellationToken.None); // Assert Assert.Equal(expected, result.ToString()); }