Ejemplo n.º 1
0
        public void When_WarningsAreFound_Expect_AllOfRequiredFieldsAreSet()
        {
            // Arrange
            var parser = BuildLogParserFactory.GetParser(BuildLogParserType.ESLint);

            // Act
            var issues = parser.GetIssues("sample-eslint-output.txt");

            // Assert
            foreach (var issue in issues)
            {
                Assert.IsNotNull(issue);
                Assert.IsNotNull(issue.IssueType);
                Assert.IsNotNull(issue.LineNumber);
                Assert.IsNotNull(issue.ColumnNumber);
                Assert.IsNotNull(issue.IssueCode);
                Assert.IsNotNull(issue.Message);
                Assert.IsNotNull(issue.SourcePath);

                Assert.AreNotEqual(String.Empty, issue.IssueType);
                Assert.AreNotEqual(String.Empty, issue.LineNumber);
                Assert.AreNotEqual(String.Empty, issue.ColumnNumber);
                Assert.AreNotEqual(String.Empty, issue.IssueCode);
                Assert.AreNotEqual(String.Empty, issue.Message);
                Assert.AreNotEqual(String.Empty, issue.SourcePath);
            }
        }
        public void When_WarningsAreFound_Expect_AllAvailableDataIsExposed()
        {
            // Arrange
            var parser = BuildLogParserFactory.GetParser(BuildLogParserType.React);

            // Act
            var issues = parser.GetIssues("sample-react-build-output.txt");

            // Assert
            foreach (var issue in issues)
            {
                Assert.IsNotNull(issue);
                Assert.IsNotNull(issue.IssueType);
                Assert.IsNotNull(issue.LineNumber);
                Assert.IsNotNull(issue.ColumnNumber);
                Assert.IsNotNull(issue.IssueCode);
                Assert.IsNotNull(issue.Message);
                Assert.IsNotNull(issue.SourcePath);

                Assert.AreNotEqual(String.Empty, issue.IssueType);
                Assert.AreNotEqual(String.Empty, issue.LineNumber);
                Assert.AreNotEqual(String.Empty, issue.ColumnNumber);
                Assert.AreNotEqual(String.Empty, issue.IssueCode);
                Assert.AreNotEqual(String.Empty, issue.Message);
                Assert.AreNotEqual(String.Empty, issue.SourcePath);
            }
        }
Ejemplo n.º 3
0
        public void When_ThereAreNoDuplicatesInInput_Expect_NoDuplicatesInOutput()
        {
            // Arrange
            var parser = BuildLogParserFactory.GetParser(BuildLogParserType.ESLint);

            // Act
            var issues = parser.GetIssues("sample-eslint-output.txt");

            // Assert
            Assert.AreEqual(issues.ToHashSet().Count, issues.Count);
        }
Ejemplo n.º 4
0
        public void When_ReactBuildOutputIsGivenAsInput_Expect_NoWarningsFound()
        {
            // Arrange
            var parser = BuildLogParserFactory.GetParser(BuildLogParserType.ESLint);

            // Act
            var issues = parser.GetIssues("sample-react-build-output.txt");

            // Assert
            Assert.IsFalse(issues.Any());
        }
Ejemplo n.º 5
0
        public void When_EslintOutputWithWarningsIsGivenAsInput_Expect_AllIssuesRecognized()
        {
            // Arrange
            var parser = BuildLogParserFactory.GetParser(BuildLogParserType.ESLint);

            // Act
            var issues = parser.GetIssues("sample-eslint-output.txt");

            // Assert
            Assert.AreEqual(544, issues.Count);
        }
        public void When_DotnetCoreBuildOutputWithWarningsIsGivenAsInput_Expect_AtLeastOneWarningFound()
        {
            // Arrange
            var parser = BuildLogParserFactory.GetParser(BuildLogParserType.Dotnet);

            // Act
            var issues = parser.GetIssues("sample-dotnet-build-output.txt");

            // Assert
            Assert.AreEqual(26, issues.Count);
        }
        public void When_NpmBuildOutputWithWarningsIsGivenAsInput_Expect_AllWarningsAreFound()
        {
            // Arrange
            var parser = BuildLogParserFactory.GetParser(BuildLogParserType.React);

            // Act
            var issues = parser.GetIssues("sample-react-build-output.txt");

            // Assert
            Assert.AreEqual(3, issues.Count);
        }
Ejemplo n.º 8
0
        public void When_EslintOutputWithWarningsIsGivenAsInput_Expect_WarningsAndErrorsAreProperlyDetected()
        {
            // Arrange
            var parser = BuildLogParserFactory.GetParser(BuildLogParserType.ESLint);

            // Act
            var issues = parser.GetIssues("sample-eslint-output.txt");

            // Assert
            Assert.AreEqual(77, issues.Count(x => x.IssueType == "warning"));
            Assert.AreEqual(467, issues.Count(x => x.IssueType == "error"));
        }
        public void When_SourcePathContainsSlashes_Expect_CompleteFilenameWithPathIsPreserved()
        {
            // Arrange
            var parser = BuildLogParserFactory.GetParser(BuildLogParserType.Dotnet);

            // Act
            var issues = parser.GetIssues("sample-dotnet-build-output-slashes.txt");

            // Assert
            Assert.AreNotEqual(0, issues.Where(x => x.SourcePath == "Service\\ServiceBusTopicClient.cs"));

            foreach (var issue in issues)
            {
                StringAssert.EndsWith(issue.SourcePath, ".cs");
            }
        }