public void ShouldCalculateNumberOfLinesForFooFirst()
        {
            var method         = _assemblySearcher.FindMethod("First");
            var lineCalculator = new NumberOfLinesCalculator(_MaxLines);
            var loc            = lineCalculator.Calculate(method);

            Assert.That(loc.Result, Is.InRange(1, 4));
        }
Example #2
0
        public void ShouldDetermineCyclomicComplexityForFooFirst()
        {
            var method = _assemblySearcher.FindMethod("First");

            var cyclomicComplextityCalculator = new ILCyclomicComplextityCalculator(_MaxCC);
            var cc = cyclomicComplextityCalculator.Calculate(method);

            Assert.That(cc.Result, Is.EqualTo(1));
        }
Example #3
0
        public void ShouldReturnNullForInvalidMethod()
        {
            var methodFinder = new AssemblySearcher(_assembly);
            var method       = methodFinder.FindMethod("NonExisting");

            Assert.That(method, Is.Null);
        }
Example #4
0
        public void ShouldLoadValidMethod()
        {
            var methodFinder = new AssemblySearcher(_assembly);
            var method       = methodFinder.FindMethod("First");

            Assert.That(method.Name, Is.EqualTo("First"));
        }
Example #5
0
        public void ShouldReturnAllInstructionsWithSequencePoints()
        {
            var method = _methodFinder.FindMethod("First");

            var instructions = method.Body.Instructions.WithSequencePoint();

            foreach (var instruction in instructions)
            {
                Assert.That(instruction.SequencePoint, Is.Not.Null);
            }
        }