コード例 #1
0
        [TestCase("fakeParam")] //TODO: this is needed until resharper fixes the issue with abstract generic tests
        public void NotToxic_WhenEverythingIsWithinTheThresholds_OneMember(string param)
        {
            var toAnalyse = HealthyInstance.WithHealthyMember <T>("ToString");
            var score     = Analyzer.CalculateToxicity(toAnalyse);

            score.Toxicity.Should().Be(0);
        }
コード例 #2
0
        [TestCase("fakeParam")] //TODO: this is needed until resharper fixes the issue with abstract generic tests
        public void NotToxic_Member_MethodLengthExceeded(string param)
        {
            var exceededMethodLength = ThresholdMethodLength + ThresholdExceeded;
            var toAnalyse            = HealthyInstance.WithHealthyMember <T>("ToString", exceededMethodLength);

            var score = Analyzer.CalculateToxicity(toAnalyse);

            score.Toxicity.Should().Be(Math.Log(ThresholdExceeded));
        }
コード例 #3
0
        [TestCase("fakeParam")] //TODO: this is needed until resharper fixes the issue with abstract generic tests
        public void NotToxic_Member_CylcomaticComplexityExceeded(string param)
        {
            var exceededCyclomaticComplexity = ThresholdCyclomaticComplexity + ThresholdExceeded;
            var toAnalyse = HealthyInstance.WithHealthyMember <T>("ToString", ThresholdMethodLength, exceededCyclomaticComplexity);

            var score = Analyzer.CalculateToxicity(toAnalyse);

            score.Toxicity.Should().Be(Math.Log(ThresholdExceeded));
        }