Beispiel #1
0
        private void UpdateData(CombinedReportData combinedData)
        {
            combinedData.Updated = DateTime.Now;

            combinedData.StartTime = combinedData.ReportSets
                                     .Aggregate((a, b) => a.Created.Ticks <= b.Created.Ticks ? a : b)
                                     .Created;

            combinedData.Duration = combinedData.ReportSets
                                    .Aggregate((a, b) => new ReportSet {
                Duration = a.Duration.Add(b.Duration)
            })
                                    .Duration;

            combinedData.ReportSets.ForEach(set => combinedData.OverallResults.Add(set.OverallResult));
            combinedData.OverallResults = combinedData.OverallResults.Distinct().ToList();

            int testsPassed = 0;

            combinedData.ReportSets.ForEach(set => testsPassed += set.CountTestsPassed);
            combinedData.TotalPassed = testsPassed;

            int testsTotal = 0;

            combinedData.ReportSets.ForEach(set => testsTotal += set.CountTests);
            combinedData.TotalTests = testsTotal;
        }
Beispiel #2
0
        internal void AddReportSet(ReportSet reportSet)
        {
            CombinedReportData combinedData = LoadCombinedData();

            combinedData.ReportSets.Add(reportSet);

            SaveCombinedData(combinedData);
        }
        private void SetHeader(CombinedReportData combined, TemplateCreator template)
        {
            template.SetTemplateParam(TemplateCreator.TemplateParamCombinedDuration, combined.Duration);

            template.SetTemplateParam(TemplateCreator.TemplateParamCombinedResult, GetResultsAsHtml(combined.OverallResults));

            template.SetTemplateParam(TemplateCreator.TemplateParamCombinedStartTime, combined.StartTime);

            template.SetTemplateParam(TemplateCreator.TemplateParamCombinedTestsPassed, combined.TotalPassed);

            template.SetTemplateParam(TemplateCreator.TemplateParamCombinedTestsTotal, combined.TotalTests);
        }
Beispiel #4
0
        private void SaveCombinedData(CombinedReportData combinedData)
        {
            UpdateData(combinedData);

            XmlSerializer xs = new XmlSerializer(typeof(CombinedReportData));

            using (TextWriter tw = new StreamWriter(_path))
            {
                xs.Serialize(tw, combinedData);
                tw.Close();
            }
        }