public async Task PreservesFragment() { // Given TestDocument target = new TestDocument(new NormalizedPath("/a/b/c.html"), new NormalizedPath("a/b/c.html")) { { WebKeys.Xref, "fizzbuzz" } }; TestExecutionContext context = new TestExecutionContext(); context.Outputs.Dictionary.Add( nameof(Content), new IDocument[] { target }.ToImmutableArray()); TestDocument document = new TestDocument( @"<html> <body> Foo <a href=""xref:fizzbuzz#foobar"">FizzBuzz</a> </body> </html>"); ResolveXrefs module = new ResolveXrefs(); // When TestDocument result = await ExecuteAsync(document, context, module).SingleAsync(); // Then result.Content.ShouldBe( @"<html><head></head><body> Foo <a href=""/a/b/c.html#foobar"">FizzBuzz</a> </body></html>", StringCompareShould.IgnoreLineEndings); }
public async Task ReturnsInputDocumentForNoXref() { // Given TestDocument target = new TestDocument(new NormalizedPath("/a/b/c.html"), new NormalizedPath("a/b/c.html")) { { WebKeys.Xref, "fizzbuzz" } }; TestExecutionContext context = new TestExecutionContext(); context.Outputs.Dictionary.Add( nameof(Content), new IDocument[] { target }.ToImmutableArray()); TestDocument document = new TestDocument( @"<html> <body> Foo </body> </html>"); ResolveXrefs module = new ResolveXrefs(); // When TestDocument result = await ExecuteAsync(document, context, module).SingleAsync(); // Then result.ShouldBe(document); }