public void SaveReport(TestSession testSession, FileInfo file) { using (FileStream fs = file.OpenWrite()) { using (StreamWriter sw = new StreamWriter(fs)) { IReportGenerator reportGenerator = new HtmlReportGenerator(sw); reportGenerator.Generate(testSession); } } }
public async Task <AssessmentReport> ProcessAsync( ServiceParityResult serviceParityResult, CostEstimationResult costEstimationResult) { //IReportGenerator reportGenerator = new PdfReportGenerator(); IReportGenerator reportGenerator = new HtmlReportGenerator(); AssessmentReport report = await reportGenerator.ProcessAsync( this.context, serviceParityResult, costEstimationResult); return(report); }
public void GenerateComparisonReport_ForNullPath_ThrowsException() { // Setup var errors = new List <string>(); var fileSystemMock = Substitute.For <IFileWrapper>(); var generator = new HtmlReportGenerator(fileSystemMock); // Act var ex = Assert.Throws <ArgumentException>( () => generator.GenerateComparisonReport(null, errors)); // Assert Assert.That(ex.Message, Is.EqualTo("Parameter 'reportPath' cannot be null or empty")); fileSystemMock.DidNotReceive().AppendAllText(Arg.Any <string>(), Arg.Any <string>()); }
public void GenerateComparisonReport_ForNullErrors_ThrowsException() { // Setup var reportPath = "C:\\Folder1\\Reports\\ScanReport.csv"; var fileSystemMock = Substitute.For <IFileWrapper>(); var generator = new HtmlReportGenerator(fileSystemMock); // Act var ex = Assert.Throws <ArgumentException>( () => generator.GenerateComparisonReport(reportPath, null)); // Assert Assert.That(ex.Message, Is.EqualTo("Parameter 'errors' cannot be null")); fileSystemMock.DidNotReceive().AppendAllText(Arg.Any <string>(), Arg.Any <string>()); }
public void GenerateComparisonReport_ForNoErrors_GeneratesEmptyReport() { // Setup var reportPath = "C:\\Folder1\\Reports\\SqlReportCompare.html"; var errors = new List <string>(); var fileSystemMock = Substitute.For <IFileWrapper>(); var generator = new HtmlReportGenerator(fileSystemMock); // Act generator.GenerateComparisonReport(reportPath, errors); // Assert fileSystemMock.Received(1).WriteAllText( "C:\\Folder1\\Reports\\SqlReportCompare.html", Arg.Is <string>(x => x.Contains("No errors found"))); }
private static void GenerateReport(string customerFile, string orderFile) { ICollection <ICustomer> customers = LoadCustomerData(customerFile, orderFile); var data = IdentifyCohorts(customers); data = data.Select(d => OrderBucketCalculator.CalculateBucket(d)).ToList(); //using (var writer = new StreamWriter("data.csv")) //{ // foreach (var item in data) // { // writer.WriteLine(item.ToString()); // } //} var reportGenerator = new HtmlReportGenerator("report.html"); reportGenerator.WriteReport(data); }
private void GenerateHTMLReport(TestSuite testSuite) { HtmlReportGenerator htmlReportGenerator = new HtmlReportGenerator(); string currentDirectoryPath = AppDomain.CurrentDomain.BaseDirectory; string str = DateTime.Now.ToString("yyyyMMddHHmmss"); StreamWriter writer; if (ConfigurationManager.AppSettings["JenkinsExecution"].Equals("true")) { string jenkinsBasePath = System.Environment.GetEnvironmentVariable("Workspace"); // string jenkinsBasePath = "C:\\Program Files (x86)\\Jenkins\\workspace\\Bnp_52012"; writer = new StreamWriter(jenkinsBasePath + "\\Bnp.Core\\Results\\BnP_TestReport.html"); } else { writer = new StreamWriter(currentDirectoryPath.Substring(0, currentDirectoryPath.IndexOf("BnPAutomation")) + "BnPAutomation\\Bnp.Core\\Results\\BnP_TestReport_" + str + ".html"); } writer.Write(htmlReportGenerator.GenerateHTMLReport(testSuite)); writer.Flush(); writer.Close(); }
public void VerifyThatArgumentNullExceptionIsThrownOnReder() { this.reportGenerator = new HtmlReportGenerator(); Assert.Throws <ArgumentNullException>(() => this.reportGenerator.Render(null)); }