Ejemplo n.º 1
0
        public void ShouldGet50MutationScore()
        {
            var file = new CsharpFileLeaf()
            {
                Name         = "SomeFile.cs",
                RelativePath = "RootFolder/SomeFile.cs",
                FullPath     = "C://RootFolder/SomeFile.cs",
                Mutants      = new Collection <Mutant>()
                {
                    new Mutant()
                    {
                        ResultStatus = MutantStatus.Survived
                    },
                    new Mutant()
                    {
                        ResultStatus = MutantStatus.Killed
                    },
                }
            };

            file.GetMutationScore().ShouldBe(0.5);
            file.CheckHealth(new Threshold(high: 80, low: 60, @break: 0)).ShouldBe(Health.Danger);
            file.CheckHealth(new Threshold(high: 80, low: 50, @break: 0)).ShouldBe(Health.Warning);
            file.CheckHealth(new Threshold(high: 50, low: 49, @break: 0)).ShouldBe(Health.Good);
        }
        public void ShouldGet0MutationScore()
        {
            var file = new CsharpFileLeaf()
            {
                RelativePath = "RootFolder/SomeFile.cs",
                FullPath     = "C://RootFolder/SomeFile.cs",
                Mutants      = new Collection <Mutant>()
                {
                    new Mutant()
                    {
                        ResultStatus = MutantStatus.Survived
                    },
                }
            };

            file.GetMutationScore().ShouldBe(0);

            var thresholdsDanger = new Thresholds
            {
                High  = 80,
                Low   = 1,
                Break = 0
            };

            file.CheckHealth(thresholdsDanger).ShouldBe(Health.Danger);
            var thresholdsWarning = new Thresholds
            {
                High  = 80,
                Low   = 0,
                Break = 0
            };

            file.CheckHealth(thresholdsWarning).ShouldBe(Health.Warning);
        }
        public void ShouldGet100MutationScore()
        {
            var file = new CsharpFileLeaf()
            {
                RelativePath = "RootFolder/SomeFile.cs",
                FullPath     = "C://RootFolder/SomeFile.cs",
                Mutants      = new Collection <Mutant>()
                {
                    new Mutant()
                    {
                        ResultStatus = MutantStatus.Killed
                    },
                }
            };

            var thresholds = new Thresholds
            {
                High  = 100,
                Low   = 50,
                Break = 0
            };

            file.GetMutationScore().ShouldBe(1);
            file.CheckHealth(thresholds).ShouldBe(Health.Good);
        }
        public void ShouldGet0MutationScoreWhenAllNoCoverage()
        {
            var file = new CsharpFileLeaf()
            {
                Mutants = new Collection <Mutant>()
                {
                    new Mutant()
                    {
                        ResultStatus = MutantStatus.NoCoverage
                    }
                }
            };

            file.GetMutationScore().ShouldBe(0);
        }
        public void ShouldGetNaNMutationScoreWhenAllExcluded()
        {
            var file = new CsharpFileLeaf()
            {
                Mutants = new Collection <Mutant>()
                {
                    new Mutant()
                    {
                        ResultStatus = MutantStatus.Ignored
                    }
                }
            };

            file.GetMutationScore().ShouldBe(double.NaN);
        }
Ejemplo n.º 6
0
        public void ShouldGet100MutationScore()
        {
            var file = new CsharpFileLeaf()
            {
                RelativePath = "RootFolder/SomeFile.cs",
                FullPath     = "C://RootFolder/SomeFile.cs",
                Mutants      = new Collection <Mutant>()
                {
                    new Mutant()
                    {
                        ResultStatus = MutantStatus.Killed
                    },
                }
            };

            file.GetMutationScore().ShouldBe(1);
            file.CheckHealth(new Threshold(high: 100, low: 50, @break: 0)).ShouldBe(Health.Good);
        }