public static void PublishReport(FeatureContext featureContext, ReportGenerator reportGenerator) { if (featureContext.TryGetValue(out FeatureDto featureDto)) { File.WriteAllText(featureDto.ReportPath, reportGenerator.BuildScenarioReport(featureDto)); var fullReportPath = Path.Combine(featureDto.ReportDirectory, "index.html"); if (File.Exists(fullReportPath)) { File.WriteAllText(fullReportPath, reportGenerator.AddScenarioToFullReport(File.ReadAllText(fullReportPath), featureDto)); } else { File.WriteAllText(fullReportPath, reportGenerator.BuildFullReport(featureDto)); } } }