public void Check_DerivedClassWithDuplicatedFragmentUsage()
        {
            var rule   = new OverridingMethodFragmentUsageRule();
            var method = GetMethodFromSampleClass <DerivedClassWithValidFragmentUsage>();

            var result = rule.Check(method);

            Assert.That(result, Is.Empty);
        }
        public void Check_FindsProblem()
        {
            var rule   = new OverridingMethodFragmentUsageRule();
            var method = GetMethodFromSampleClass <DerivedClassWithInvalidFragmentUsage>();

            var result = rule.Check(method);

            Assert.That(TestHelper.ContainsProblemID(c_InjectionCopRuleId, result), Is.True);
        }
        public void Check_MatchesParametersCorrectly()
        {
            var rule    = new OverridingMethodFragmentUsageRule();
            var method1 = IntrospectionUtility.MethodFactory <DerivedClassWithInvalidFragmentUsage> (
                "MethodWithFragmentOnSecondParameter", IntrospectionUtility.TypeNodeFactory <int>(), IntrospectionUtility.TypeNodeFactory <int>());
            var method = method1;

            var result = rule.Check(method);

            Assert.That(TestHelper.ContainsProblemID(c_InjectionCopRuleId, result), Is.True);
        }
        public void Check_FormatsMessage()
        {
            var rule   = new OverridingMethodFragmentUsageRule();
            var method = GetMethodFromSampleClass <DerivedClassWithInvalidFragmentUsage>();

            var result  = rule.Check(method);
            var problem = result[0];

            Assert.That(
                problem.Resolution.ToString(),
                Is.EqualTo("Expected fragment of type 'ValidFragmentType' from overriden method, but got 'InvalidFragmentType'."));
        }