예제 #1
0
        public void VerifyFileDidnotExist()
        {
            SetupMocks();
            var coberturaXml  = CoberturaFileDidnotExist();
            var summaryReader = new CoberturaSummaryReader();

            Assert.Throws <ArgumentException>(() => summaryReader.GetCodeCoverageSummary(_ec.Object, coberturaXml));
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
            }
        }
예제 #5
0
        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);
            }
        }