private static void GetPreviousVersionStats(Report report, ReportViewModel viewReport, ReportTestStatistics latestStats)
        {
            if (report.Previous == null)
            {
                return;
            }

            var previousStats = report.Previous.Statistics;
            if (previousStats.IsEmpty)
            {
                return;
            }
                
            if (latestStats.PercentageSuccess > previousStats.PercentageSuccess)
            {
                viewReport.StateChange = ReportViewModel.ProjectStateChange.Good;
            }
            else if (latestStats.PercentageSuccess == previousStats.PercentageSuccess)
            {
                viewReport.StateChange = ReportViewModel.ProjectStateChange.Neutral;
            }
            else if (latestStats.PercentageSuccess < previousStats.PercentageSuccess)
            {
                viewReport.StateChange = ReportViewModel.ProjectStateChange.Bad;
            }
            viewReport.HasPreviousStats = true;
        }
        private ReportTestStatistics CalculateStatistics(ReportVersion version)
        {
            var statistics = new ReportTestStatistics();
            
            //Calucate all the stats 
            // Load test results xml from the latest version
            var xmlPath = Path.Combine(version.Path, "TestResult.xml");
            if(File.Exists(xmlPath))
            {
                var document = LoadXml(xmlPath);

                var total = document.Root.Attributes().First(x => x.Name == "total").Value;
                int noOfTests = int.Parse(total);
                statistics.NumberOfTests = noOfTests;

                var failures = document.Root.Attributes().First(x => x.Name == "failures").Value;
                int noOfFailures = int.Parse(failures);
                statistics.Failures = noOfFailures;

                var inconclusive = document.Root.Attributes().First(x => x.Name == "inconclusive").Value;
                int noOfInconclusive = int.Parse(inconclusive);
                statistics.Inconclusive = noOfInconclusive;

                int success = noOfTests - noOfFailures - noOfInconclusive;
                statistics.Success = success;
            }
            return statistics;
        }