Exemple #1
0
        private static string CheckStandardArgsPassed(TestLogger logger, string expectedPropertiesFilePath)
        {
            var message = logger.AssertSingleInfoMessageExists(ExpectedConsoleMessagePrefix);

            CheckArgExists("-Dproject.settings=" + expectedPropertiesFilePath, message); // should always be passing the properties file

            return(message);
        }
        private void AssertRuleTemplateFileExistsForPackage(TestLogger logger, string outputDir, IPackage package)
        {
            string expectedFilePath = GetExpectedRuleTemplateFilePath(outputDir, package);

            File.Exists(expectedFilePath).Should().BeTrue();
            this.TestContext.AddResultFile(expectedFilePath);
            logger.AssertSingleInfoMessageExists(expectedFilePath); // should be a message about the generated file
        }
Exemple #3
0
        private void AssertSqaleFileExistsForPackage(TestLogger logger, string outputDir, IPackage package)
        {
            string expectedTemplateSqaleFilePath = GetExpectedTemplateSqaleFilePath(outputDir, package);

            Assert.IsTrue(File.Exists(expectedTemplateSqaleFilePath), "Expecting a template sqale file to have been created");
            this.TestContext.AddResultFile(expectedTemplateSqaleFilePath);
            logger.AssertSingleInfoMessageExists(expectedTemplateSqaleFilePath); // should be a message about the generated file
        }
        private static string CheckStandardArgsPassed(TestLogger logger, string expectedPropertiesFilePath)
        {
            string message = logger.AssertSingleInfoMessageExists(ExpectedConsoleMessagePrefix);

            CheckArgExists("-Dproject.settings=" + expectedPropertiesFilePath, message);   // should always be passing the properties file
            CheckArgExists(SonarRunnerWrapper.StandardAdditionalRunnerArguments, message); // standard args should always be passed

            return(message);
        }
        public void TrxReader_InvalidTrxFile()
        {
            // Arrange
            var testResults = CreateDirectories(RootDirectory, "TestResults")[0];

            CreateFiles(testResults, ("dummy.trx", "this is not a trx file"));

            // Act
            var coverageFilePaths = trxReader.FindCodeCoverageFiles(RootDirectory);

            // Assert
            coverageFilePaths.Should().BeEmpty();

            logger.AssertSingleInfoMessageExists("No code coverage attachments were found from the trx files.");
            logger.Warnings.Should().HaveCount(1);
            logger.Warnings[0].Should().Match(@"Located trx file is not a valid xml file. File: *\TestResults\dummy.trx. File load error: Data at the root level is invalid. Line 1, position 1."); // expecting a warning about the invalid file
            logger.AssertErrorsLogged(0);                                                                                                                                                           // should be a warning, not an error
        }