public void MinifyWithCustomSettings() { // Given string input = @"<html> <head> <title>Title</title> </head> <body> <!-- FOO --> <h1>Title</h1> <p>This is<br />some text</p> </body> </html>"; string output = @"<html><head><title>Title</title></head><body><!-- FOO --><h1>Title</h1><p>This is<br>some text</p></body></html>"; IExecutionContext context = Substitute.For<IExecutionContext>(); IDocument document = Substitute.For<IDocument>(); document.Content.Returns(input); MinifyHtml minifyHtml = new MinifyHtml() .WithSettings(settings => { settings.RemoveOptionalEndTags = false; settings.RemoveHtmlComments = false; }); // When minifyHtml.Execute(new[] { document }, context).ToList(); // Make sure to materialize the result list // Then context.Received(1).GetDocument(Arg.Any<IDocument>(), Arg.Any<string>()); context.Received().GetDocument(document, output); }
public void MinifyWithCustomSettings() { // Given string input = @"<html> <head> <title>Title</title> </head> <body> <!-- FOO --> <h1>Title</h1> <p>This is<br />some text</p> </body> </html>"; string output = @"<html><head><title>Title</title></head><body><!-- FOO --><h1>Title</h1><p>This is<br>some text</p></body></html>"; TestExecutionContext context = new TestExecutionContext(); TestDocument document = new TestDocument(input); MinifyHtml minifyHtml = new MinifyHtml() .WithSettings(settings => { settings.RemoveOptionalEndTags = false; settings.RemoveHtmlComments = false; }); // When IList <IDocument> results = minifyHtml.Execute(new[] { document }, context).ToList(); // Make sure to materialize the result list // Then results.Single().Content.ShouldBe(output, StringCompareShould.IgnoreLineEndings); }
public void MinifyWithCustomSettings() { // Given string input = @"<html> <head> <title>Title</title> </head> <body> <!-- FOO --> <h1>Title</h1> <p>This is<br />some text</p> </body> </html>"; string output = @"<html><head><title>Title</title></head><body><!-- FOO --><h1>Title</h1><p>This is<br>some text</p></body></html>"; IExecutionContext context = Substitute.For <IExecutionContext>(); IDocument document = Substitute.For <IDocument>(); document.Content.Returns(input); MinifyHtml minifyHtml = new MinifyHtml() .WithSettings(settings => { settings.RemoveOptionalEndTags = false; settings.RemoveHtmlComments = false; }); // When minifyHtml.Execute(new[] { document }, context).ToList(); // Make sure to materialize the result list // Then context.Received(1).GetDocument(Arg.Any <IDocument>(), Arg.Any <string>()); context.Received().GetDocument(document, output); }
public void MinifyWithCustomSettings() { // Given string input = @"<html> <head> <title>Title</title> </head> <body> <!-- FOO --> <h1>Title</h1> <p>This is<br />some text</p> </body> </html>"; string output = @"<html><head><title>Title</title></head><body><!-- FOO --><h1>Title</h1><p>This is<br>some text</p></body></html>"; TestExecutionContext context = new TestExecutionContext(); TestDocument document = new TestDocument(input); MinifyHtml minifyHtml = new MinifyHtml() .WithSettings(settings => { settings.RemoveOptionalEndTags = false; settings.RemoveHtmlComments = false; }); // When IList <IDocument> results = minifyHtml.Execute(new[] { document }, context).ToList(); // Make sure to materialize the result list // Then Assert.That(results.Select(x => x.Content), Is.EquivalentTo(new[] { output })); }
public void Minify() { // Given const string input = @"<html> <head> <title>Title</title> </head> <body> <!-- FOO --> <h1>Title</h1> <p>This is<br />some text</p> </body> </html>"; const string output = "<html><head><title>Title</title><body><h1>Title</h1><p>This is<br>some text"; TestExecutionContext context = new TestExecutionContext(); TestDocument document = new TestDocument(input); MinifyHtml minifyHtml = new MinifyHtml(); // When IList <IDocument> results = minifyHtml.Execute(new[] { document }, context).ToList(); // Make sure to materialize the result list // Then results.Single().Content.ShouldBe(output, StringCompareShould.IgnoreLineEndings); }