public string CreateReport(IEnumerable <IIssue> issues)
        {
            var generator =
                new GenericIssueReportGenerator(this.Log, this.GenericIssueReportFormatSettings);

            var reportFile = Path.GetTempFileName();

            try
            {
                var createIssueReportSettings =
                    new CreateIssueReportSettings(@"c:\Source\Cake.Issues.Reporting.Generic", reportFile);
                generator.Initialize(createIssueReportSettings);
                generator.CreateReport(issues);

                using (var stream = new FileStream(reportFile, FileMode.Open, FileAccess.Read))
                {
                    using (var sr = new StreamReader(stream))
                    {
                        return(sr.ReadToEnd());
                    }
                }
            }
            finally
            {
                if (File.Exists(reportFile))
                {
                    File.Delete(reportFile);
                }
            }
        }
            public void Should_Set_OutputFilePath_If_Not_Null()
            {
                // Given
                DirectoryPath repoRoot   = @"c:\repo";
                FilePath      outputFile = @"C:\report.html";

                // When
                var settings = new CreateIssueReportSettings(repoRoot, outputFile);

                // Then
                settings.OutputFilePath.ShouldBe(outputFile);
            }
Beispiel #3
0
        /// <inheritdoc />
        public override bool Initialize(CreateIssueReportSettings settings)
        {
            var result = base.Initialize(settings);

            return(result && !this.ShouldFailOnInitialization);
        }