Exemple #1
0
        public void ShouldExecuteRegisteredAction_WhenTreeIsNull_ReturnsFalse()
        {
            // Arrange
            var testSubject = new TestableSonarAnalyzerWorkflow(new AdhocWorkspace());

            // Act
            var result = testSubject.ShouldExecuteRegisteredAction(null);

            // Assert
            result.Should().BeFalse();
        }
Exemple #2
0
        public void ShouldExecuteRegisteredAction_WhenTreeNotNullAndNuGetAnalyzerDifferentVersion_ReturnsFalse()
        {
            // Arrange
            var testSubject = new TestableSonarAnalyzerWorkflow(new AdhocWorkspace());

            testSubject.GetProjectNuGetAnalyzerStatusFunc = tree => ProjectAnalyzerStatus.DifferentVersion;

            // Act
            var result = testSubject.ShouldExecuteRegisteredAction(new Mock <SyntaxTree>().Object);

            // Assert
            result.Should().BeFalse();
        }
        public void ShouldExecuteRegisteredAction_WhenTreeNotNullAndNoNuGetAnalyzer_ReturnsTrue()
        {
            // Arrange
            var testSubject = new TestableSonarAnalyzerWorkflow(new AdhocWorkspace());

            testSubject.GetProjectNuGetAnalyzerStatusFunc = tree => ProjectAnalyzerStatus.NoAnalyzer;

            // Act
            var result = testSubject.ShouldExecuteRegisteredAction(Enumerable.Empty <DiagnosticDescriptor>(), new Mock <SyntaxTree>().Object);

            // Assert
            result.Should().BeTrue();
        }