示例#1
0
            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));
            }
示例#2
0
            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));
            }
示例#3
0
            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));
            }
示例#4
0
            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));
            }
示例#5
0
            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));
            }