コード例 #1
0
        public bool Generate(string inputFilePath, string outputLocation)
        {
            var builder = new ReportConfigurationBuilder();
            var config  = builder.Create(new Dictionary <string, string>
            {
                { "Reports", $"{inputFilePath}" },
                { "TargetDir", $"{outputLocation}" },
                { "ReportTypes", "Cobertura" }
            });
            IReportGenerator generator = new Generator();

            return(generator.GenerateReport(config));
        }
コード例 #2
0
        public bool GenerateCoverageReport(string coverageFile, string diretoryOutputCoverage)
        {
            var args = new Dictionary <string, string>
            {
                { "reports", coverageFile },
                { "targetdir", diretoryOutputCoverage.Replace(@"""", string.Empty) },
                { "reporttypes", "HTMLSummary;Badges;HtmlInline" },
                { "plugins", "" }
            };

            var reportConfigurationBuilder = new ReportConfigurationBuilder();
            var configuration = reportConfigurationBuilder.Create(args);

            return(new Generator().GenerateReport(configuration));
        }
コード例 #3
0
        public void InitWithLegacyArguments_AllPropertiesApplied()
        {
            string[] legacyArguments = new string[]
            {
                reportPath,
                "C:\\temp",
                ReportTypes.Latex.ToString()
            };

            this.configuration = ReportConfigurationBuilder.Create(legacyArguments);

            Assert.IsTrue(this.configuration.ReportFiles.Contains(reportPath), "ReportPath does not exist in ReportFiles.");
            Assert.AreEqual("C:\\temp", this.configuration.TargetDirectory, "Wrong target directory applied.");
            Assert.AreEqual(ReportTypes.Latex, this.configuration.ReportType, "Wrong report type applied.");
            Assert.IsFalse(this.configuration.SourceDirectories.Any(), "Source directories should be empty.");
            Assert.IsFalse(this.configuration.Filters.Any(), "Filters should be empty.");
        }
コード例 #4
0
        public void InitWithNamedArguments_AllPropertiesApplied()
        {
            string[] namedArguments = new string[]
            {
                "-reports:" + reportPath,
                "-targetdir:C:\\temp",
                "-reporttype:" + ReportTypes.Latex.ToString(),
                "-sourcedirs:C:\\temp\\source;C:\\temp\\source2",
                "-filters:+Test;-Test",
                "-verbosity:" + VerbosityLevel.Info.ToString()
            };

            this.configuration = ReportConfigurationBuilder.Create(namedArguments);

            Assert.IsTrue(this.configuration.ReportFiles.Contains(reportPath), "ReportPath does not exist in ReportFiles.");
            Assert.AreEqual("C:\\temp", this.configuration.TargetDirectory, "Wrong target directory applied.");
            Assert.AreEqual(ReportTypes.Latex, this.configuration.ReportType, "Wrong report type applied.");
            Assert.IsTrue(this.configuration.SourceDirectories.Contains("C:\\temp\\source"), "Directory does not exist in Source directories.");
            Assert.IsTrue(this.configuration.SourceDirectories.Contains("C:\\temp\\source2"), "Directory does not exist in Source directories.");
            Assert.IsTrue(this.configuration.Filters.Contains("+Test"), "Filter does not exist in ReportFiles.");
            Assert.IsTrue(this.configuration.Filters.Contains("-Test"), "Filter does not exist in ReportFiles.");
            Assert.AreEqual(VerbosityLevel.Info, this.configuration.VerbosityLevel, "Wrong verbosity level applied.");
        }