Exemplo n.º 1
0
        public void Check_BlackListDoesNotContainMethod_RaisesProblem()
        {
            TypeNode   sample           = IntrospectionUtility.TypeNodeFactory <FragmentGeneratorSample>();
            var        blacklistManager = MockRepository.GenerateStub <IBlacklistManager>();
            const bool isGenerator      = true;

            blacklistManager.Stub(
                manager =>
                manager.GetFragmentTypes(
                    Arg <string> .Is.Anything,
                    Arg <string> .Is.Anything,
                    Arg <string> .Matches(_ => _ != "UnsafeWithoutGenerator"),
                    Arg <IList <string> > .Is.Anything)).Return(new FragmentSignature(new string[0], "", isGenerator));

            blacklistManager.Stub(_ => _.GetFragmentTypes(sample.DeclaringModule.Name, sample.FullName, "UnsafeWithoutGenerator", new string[0]))
            .Return(null);

            _typeParser = new TypeParser(blacklistManager);
            _typeParser.BeforeAnalysis();
            _typeParser.Check(sample);

            Assert.That(TestHelper.ContainsProblemID(c_InjectionCopRuleId, _typeParser.Problems), Is.True);
        }