Esempio n. 1
0
        public void ProcessFile_HeaderFile_IsNotProcessed()
        {
            // Arrange
            var daemonMock        = new Mock <ISonarLintDaemon>();
            var issueConsumerMock = new Mock <IIssueConsumer>();
            var loggerMock        = new Mock <ILogger>();

            var projectItemMock = new Mock <ProjectItem>();

            // Act
            CFamily.ProcessFile(daemonMock.Object, issueConsumerMock.Object,
                                loggerMock.Object, projectItemMock.Object, "c:\\dummy\\file.h", "charset");

            // Assert
            AssertMessageLogged(loggerMock, "Cannot analyze header files. File: 'c:\\dummy\\file.h'");
            AssertFileNotAnalysed(daemonMock);
        }
Esempio n. 2
0
        public void ProcessFile_ErrorGetting_IsHandled()
        {
            // Arrange
            var daemonMock        = new Mock <ISonarLintDaemon>();
            var issueConsumerMock = new Mock <IIssueConsumer>();
            var loggerMock        = new Mock <ILogger>();

            var projectItemMock = CreateProjectItemWithProject("c:\\foo\\xxx.vcxproj");

            // Act
            CFamily.ProcessFile(daemonMock.Object, issueConsumerMock.Object,
                                loggerMock.Object, projectItemMock.Object, "c:\\dummy\\file.cpp", "charset");

            // Assert
            AssertPartialMessageLogged(loggerMock,
                                       "Unable to collect C/C++ configuration for c:\\dummy\\file.cpp: ");
            AssertFileNotAnalysed(daemonMock);
        }
Esempio n. 3
0
        public void ProcessFile_FileOutsideSolution_IsNotProcessed()
        {
            // Arrange
            var daemonMock        = new Mock <ISonarLintDaemon>();
            var issueConsumerMock = new Mock <IIssueConsumer>();
            var loggerMock        = new Mock <ILogger>();

            var projectItemMock = CreateProjectItemWithProject("c:\\foo\\SingleFileISense\\xxx.vcxproj");

            // Act
            CFamily.ProcessFile(daemonMock.Object, issueConsumerMock.Object,
                                loggerMock.Object, projectItemMock.Object, "c:\\dummy\\file.cpp", "charset");

            // Assert
            AssertMessageLogged(loggerMock,
                                "Unable to retrieve the configuration for file 'c:\\dummy\\file.cpp'. Check the file is part of a project in the current solution.");
            AssertFileNotAnalysed(daemonMock);
        }