public void VerifyFileDidnotExist()
 {
     SetupMocks();
     var coberturaXml = CoberturaFileDidnotExist();
     var summaryReader = new CoberturaSummaryReader();
     Assert.Throws<ArgumentException>(() => summaryReader.GetCodeCoverageSummary(_ec.Object, coberturaXml));
 }
 public void VerifyEmptyXmlFile()
 {
     var emptyXml = GetEmptyCCFile();
     try
     {
         SetupMocks();
         var summaryReader = new CoberturaSummaryReader();
         Assert.Null(summaryReader.GetCodeCoverageSummary(_ec.Object, emptyXml));
         Assert.Equal(0, _errors.Count);
         Assert.Equal(0, _warnings.Count);
     }
     finally
     {
         File.Delete(emptyXml);
     }
 }
        public void VerifyInvalidXmlFile()
        {
            var invalidXml = CoberturaInvalidXmlFile();
            try
            {
                SetupMocks();
                var summaryReader = new CoberturaSummaryReader();
                summaryReader.GetCodeCoverageSummary(_ec.Object, invalidXml);
            }
            finally
            {
                File.Delete(invalidXml);
            }

            Assert.Equal(0, _errors.Count);
            Assert.Equal(1, _warnings.Count);
        }
 public void VerifyCoberturaCoverageStatisticsForValidSummaryFile()
 {
     string coberturaXml = GetPathToValidCoberturaFile();
     try
     {
         SetupMocks();
         var summaryReader = new CoberturaSummaryReader();
         IEnumerable<CodeCoverageStatistics> coverageStats = summaryReader.GetCodeCoverageSummary(_ec.Object, coberturaXml);
         List<CodeCoverageStatistics> coverageStatsNew = coverageStats.ToList();
         coverageStatsNew.Sort(new Statscomparer());
         Assert.Equal(0, _errors.Count);
         Assert.Equal(0, _warnings.Count);
         VerifyLineCoverageStats(coverageStatsNew.ToList());
         VerifyBranchCoverageStats(coverageStatsNew.ToList());
     }
     finally
     {
         File.Delete(coberturaXml);
     }
 }
 public void VerifyWrongXmlFile()
 {
     var wrongXml = CoberturaWrongXmlFile();
     try
     {
         SetupMocks();
         var summaryReader = new CoberturaSummaryReader();
         var coverageStats = summaryReader.GetCodeCoverageSummary(_ec.Object, wrongXml);
         Assert.Equal(coverageStats.ToList().Count, 0);
         Assert.Equal(0, _errors.Count);
         Assert.Equal(0, _warnings.Count);
     }
     finally
     {
         File.Delete(wrongXml);
     }
 }