public async Task WhenInvalidUrl_ThrowsInvalidOperationException(string url) { // Arrange. var request = ReadMeServiceFacts.GetReadMeRequest(ReadMeService.TypeUrl, "markdown"); // Act & Assert. await Assert.ThrowsAsync <ArgumentException>(() => ReadMeService.GetReadMeMdAsync(request, Encoding.UTF8)); }
public async Task WhenFileAndExtensionInvalid_ThrowsInvalidOperationException(string fileExt) { // Arrange. var request = ReadMeServiceFacts.GetReadMeRequest(ReadMeService.TypeFile, "markdown", fileName: $"README.{fileExt}"); // Act & Assert. await Assert.ThrowsAsync <InvalidOperationException>(() => ReadMeService.GetReadMeMdAsync(request, Encoding.UTF8)); }
public async Task WhenMaxLengthExceeded_ThrowsInvalidOperationException(string sourceType) { // Arrange. var request = ReadMeServiceFacts.GetReadMeRequest(ReadMeService.TypeWritten, LargeMarkdown); // Act & Assert. await Assert.ThrowsAsync <InvalidOperationException>(() => ReadMeService.GetReadMeMdAsync(request, Encoding.UTF8)); }
public async Task WhenValid_ReturnsSourceContent(string sourceType) { // Arrange. var request = ReadMeServiceFacts.GetReadMeRequest(sourceType, "markdown"); // Act & Assert. Assert.Equal("markdown", await ReadMeService.GetReadMeMdAsync(request, Encoding.UTF8)); }
public async Task WhenInvalidSourceType_ThrowsInvalidOperationException(string sourceType) { // Arrange. var request = ReadMeServiceFacts.GetReadMeRequest(sourceType, "markdown"); // Act & Assert. await Assert.ThrowsAsync <InvalidOperationException>(() => ReadMeService.GetReadMeMdAsync(request, Encoding.UTF8)); }