コード例 #1
0
        public void TextLineAtSign_ShouldReplaceWithTextTags()
        {
            string expectedResult = DataHelpers.WithAtSignTextExpectedResult;
            string minifiedHtml   = StreamReaderExtension.MinifyHtmlCode(DataHelpers.WithAtSignText, noFeatures);

            Assert.That(minifiedHtml, Is.EqualTo(expectedResult));
        }
コード例 #2
0
        public void CommentLineWithTripleSlash_ShouldBeRemoved()
        {
            string expectedResult = DataHelpers.CommentLineWithTripleSlashExpectedResult;
            string minifiedHtml   = StreamReaderExtension.MinifyHtmlCode(DataHelpers.CommentLineWithTripleSlash, noFeatures);

            Assert.That(minifiedHtml, Is.EqualTo(expectedResult));
        }
コード例 #3
0
        public void ModelViewDoubleLessThanSign_ShouldTakenToTop()
        {
            string expectedResult = DataHelpers.TupleModelExpectedResult;
            string minifiedHtml   = StreamReaderExtension.MinifyHtmlCode(DataHelpers.TupleModel, noFeatures);

            Assert.That(minifiedHtml, Is.EqualTo(expectedResult));
        }
コード例 #4
0
        public void TestCommentsRemove()
        {
            string expected = DataHelpers.CommentsRemoveResult;

            string minifiedHtml = StreamReaderExtension.MinifyHtmlCode(DataHelpers.CommentsRemoveInput, noFeatures);

            Assert.That(minifiedHtml, Is.EqualTo(expected));
        }
コード例 #5
0
        public void GithubIssue36_ShouldReturnCorrectly()
        {
            // Act
            string minifiedHtml = StreamReaderExtension.MinifyHtmlCode(DataHelpers.GithubIssue36, noFeatures);

            // Assert
            Assert.That(minifiedHtml, Is.EqualTo(DataHelpers.GithubIssue36Result));
        }
コード例 #6
0
        public void BadHTML_ShouldReturnCorrectly()
        {
            string badHtml = "@model .";
            // Act
            string minifiedHtml = StreamReaderExtension.MinifyHtmlCode(badHtml, noFeatures);

            // Assert
            Assert.That(badHtml, Is.EqualTo(badHtml));
        }
コード例 #7
0
        public void RemoveMultipleHtmlComments_WithIncludeVirtuals_ShouldReturnCorrectly()
        {
            string expectedResult = DataHelpers.WithIncludeVirtualsResult;

            // Act
            string minifiedHtml = StreamReaderExtension.MinifyHtmlCode(DataHelpers.WithIncludeVirtuals, noFeatures);

            // Assert
            Assert.That(minifiedHtml, Is.EqualTo(expectedResult));
        }
コード例 #8
0
        public void GithubIssue13_ShouldReturnCorrectly()
        {
            // A fix for a Github issue - https://github.com/deanhume/html-minifier/issues/13
            string expectedResult = DataHelpers.GithubIssue13Result;

            // Act
            string minifiedHtml = StreamReaderExtension.MinifyHtmlCode(DataHelpers.GithubIssue13, noFeatures);

            // Assert
            Assert.That(minifiedHtml, Is.EqualTo(expectedResult));
        }
コード例 #9
0
        public void MinifyContents_WithLanguageSpecficCharacters_ShouldReturnCorrectly()
        {
            // Arrange
            string expectedResult = DataHelpers.LanguageSpecificCharactersResult;

            // Act
            string minifiedHtml = StreamReaderExtension.MinifyHtmlCode(DataHelpers.LanguageSpecificCharacters, noFeatures);

            // Assert
            Assert.That(minifiedHtml, Is.EqualTo(expectedResult));
        }
コード例 #10
0
        public void MinifyContents_WithModelList_ShouldReturnCorrectly()
        {
            // Arrange
            string expectedResult = DataHelpers.ModelListResult;

            // Act
            string minifiedHtml = StreamReaderExtension.MinifyHtmlCode(DataHelpers.ModelList, noFeatures);

            // Assert
            Assert.That(minifiedHtml, Is.EqualTo(expectedResult));
        }
コード例 #11
0
        public void ReadHtml_WithStandardText_ShouldReturnCorrectly()
        {
            // Arrange
            string expectedResult = DataHelpers.StandardResult;

            // Act
            string minifiedHtml = StreamReaderExtension.MinifyHtmlCode(DataHelpers.Standard, noFeatures);

            // Assert
            Assert.That(minifiedHtml, Is.EqualTo(expectedResult));
        }
コード例 #12
0
        public void RemoveMultipleJavaScriptComments_WithStandardText_ShouldReturnCorrectly()
        {
            // Arrange
            string expectedResult = DataHelpers.MultipleJavaScriptCommentsResult;

            // Act
            string removedComments = StreamReaderExtension.RemoveJavaScriptComments(DataHelpers.MultipleJavaScriptComments);

            // Assert
            Assert.That(removedComments, Is.EqualTo(expectedResult));
        }
コード例 #13
0
        public void GithubIssue19Multiple_ShouldReturnCorrectly()
        {
            // A fix for a Github issue - https://github.com/deanhume/html-minifier/issues/19
            string expectedResult = DataHelpers.GithubIssue19MultipleResult;

            // Act
            string minifiedHtml = StreamReaderExtension.MinifyHtmlCode(DataHelpers.GithubIssue19Multiple, noFeatures);

            // Assert
            Assert.AreEqual(minifiedHtml, expectedResult);
        }
コード例 #14
0
        public void ReadHtRazor_WithOnlyDeclaration_ShouldReturnCorrectly()
        {
            // Arrange
            string expectedResult = DataHelpers.OnlyDeclarationResult;

            // Act
            string minifiedHtml = StreamReaderExtension.MinifyHtmlCode(DataHelpers.OnlyDeclaration, noFeatures);

            // Assert
            Assert.That(minifiedHtml, Is.EqualTo(expectedResult));
        }
コード例 #15
0
        public void GithubIssue44_ShouldReturnCorrectly()
        {
            // Arrange
            string expectedResult = DataHelpers.GithubIssue44Result;

            // Act
            string minifiedHtml = StreamReaderExtension.MinifyHtmlCode(DataHelpers.GithubIssue44, noFeatures);

            // Assert
            Assert.AreEqual(minifiedHtml, expectedResult);
        }
コード例 #16
0
        public void MinifyContents_WithComments_ShouldReturnCorrectly()
        {
            // Arrange
            string expectedResult = DataHelpers.CommentsResult;

            // Act
            string minifiedHtml = StreamReaderExtension.MinifyHtmlCode(DataHelpers.Comments, noFeatures);

            // Assert
            Assert.AreEqual(minifiedHtml, expectedResult);
        }
コード例 #17
0
        public void SixtyFiveKCharacters_ShouldBreakToNextLine()
        {
            // A fix for a Github issue - https://github.com/deanhume/html-minifier/issues/14
            List <string> args = new List <string> {
                "pathToFiles", "60000"
            };

            string expectedResult = DataHelpers.SixtyFiveThousandCharactersResult;

            // Act
            string minifiedHtml = StreamReaderExtension.MinifyHtmlCode(DataHelpers.SixtyFiveThousandCharacters, new Features(args.ToArray()));

            // Assert
            Assert.That(minifiedHtml, Is.EqualTo(expectedResult));
        }
コード例 #18
0
        public void SixtyFiveKCharacters_WithoutArgs_ShouldMakeNoChange()
        {
            // A fix for a Github issue - https://github.com/deanhume/html-minifier/issues/14
            List <string> args = new List <string> {
                "pathToFiles"
            };

            string expectedResult = DataHelpers.SixtyFiveThousandCharactersNoBreakResult;

            // Act
            string minifiedHtml = StreamReaderExtension.MinifyHtmlCode(DataHelpers.SixtyFiveThousandCharacters, new Features(args.ToArray()));

            // Assert
            Assert.AreEqual(minifiedHtml, expectedResult);
        }
コード例 #19
0
        public void GithubIssue23_ShouldReturnCorrectly()
        {
            // A fix for a Github issue - https://github.com/deanhume/html-minifier/issues/23
            string expectedResult = DataHelpers.GithubIssue23Result;

            // test IgnoreHtmlComments
            List <string> args = new List <string> {
                "ignorehtmlcomments"
            };

            // Act
            string minifiedHtml = StreamReaderExtension.MinifyHtmlCode(DataHelpers.GithubIssue23, new Features(args.ToArray()));

            // Assert
            Assert.That(minifiedHtml, Is.EqualTo(expectedResult));
        }