Beispiel #1
0
        public void ShouldGet50MutationScore()
        {
            var file = new FileLeaf()
            {
                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);
        }
Beispiel #2
0
        private IDictionary <string, JsonReportFileComponent> GenerateFileReportComponents(FileLeaf fileComponent)
        {
            var reportComponent = new JsonReportFileComponent(fileComponent)
            {
                Health = fileComponent.CheckHealth(_options.Thresholds)
            };

            return(new Dictionary <string, JsonReportFileComponent> {
                { fileComponent.RelativePath, reportComponent }
            });
        }