Пример #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);
            }
        }