Exemplo n.º 1
0
        public void matches_based_on_noneOf_twice()
        {
            instance.NoneOf(NONE_OF);
            instance.NoneOf(NONE_OF_2);
            ITypeFilter typeFilter = instance.CreateTypeFilter();

            Assert.False(typeFilter.Matches(ITEM_B));
            Assert.False(typeFilter.Matches(ITEM_C));
        }
Exemplo n.º 2
0
        public void matches_based_on_anyOf_twice()
        {
            instance.AnyOf(ANY_OF);
            instance.AnyOf(ANY_OF_2);
            ITypeFilter typeFilter = instance.CreateTypeFilter();

            Assert.True(typeFilter.Matches(ITEM_A));
            Assert.True(typeFilter.Matches(ITEM_B));
            Assert.True(typeFilter.Matches(ITEM_C));
        }
Exemplo n.º 3
0
        public void Intersection()
        {
            Assert.IsTrue(exceptionFilter.Matches(typeof(SystemException)));
            Assert.IsTrue(hasRootCauseFilter.Matches(typeof(StackOverflowException)));

            ITypeFilter intersection = TypeFilters.Intersection(exceptionFilter, hasRootCauseFilter);

            Assert.IsFalse(intersection.Matches(typeof(SystemException)));
            Assert.IsFalse(intersection.Matches(typeof(TestObject)));
            Assert.IsTrue(intersection.Matches(typeof(StackOverflowException)));
        }
Exemplo n.º 4
0
        public void Union()
        {
            Assert.IsTrue(exceptionFilter.Matches(typeof(SystemException)));
            Assert.IsFalse(exceptionFilter.Matches(typeof(TestObject)));
            Assert.IsFalse(itoFilter.Matches(typeof(Exception)));
            Assert.IsTrue(itoFilter.Matches(typeof(TestObject)));
            ITypeFilter union = TypeFilters.Union(exceptionFilter, itoFilter);

            Assert.IsTrue(union.Matches(typeof(SystemException)));
            Assert.IsTrue(union.Matches(typeof(TestObject)));
        }
        public void DefaultClassFilterImplAlwaysMatchesRegardless()
        {
            Type oneType               = typeof(One);
            ControlFlowPointcut cut    = new ControlFlowPointcut(oneType);
            ITypeFilter         filter = cut.TypeFilter;

            Assert.IsTrue(filter.Matches(oneType),
                          "Must always match regardless of the supplied argument Type.");
            Assert.IsTrue(filter.Matches(GetType()),
                          "Must always match even if the supplied argument Type is not " +
                          "a match for the Type supplied in the ctor.");
            Assert.IsTrue(filter.Matches(null),             // args are ingored in this impl...
                          "Must always match even if the supplied argument Type is null");
        }
Exemplo n.º 6
0
        public void matches_based_on_noneOf()
        {
            instance.NoneOf(NONE_OF);
            ITypeFilter typeFilter = instance.CreateTypeFilter();

            Assert.True(typeFilter.Matches(ITEM_B));
        }
Exemplo n.º 7
0
        public void matches_based_on_anyOf()
        {
            instance.AnyOf(ANY_OF);
            ITypeFilter typeFilter = instance.CreateTypeFilter();

            Assert.That(typeFilter.Matches(ITEM_A), Is.True);
        }
Exemplo n.º 8
0
        public void doesnt_match_subpackage_c_based_on_required_and_noneOf()
        {
            instance.Require(REQUIRE).NoneOf(NONE_OF);
            ITypeFilter typeFilter = instance.CreateTypeFilter();

            Assert.False(typeFilter.Matches(ITEM_C));
        }
Exemplo n.º 9
0
        public void matches_subpackage_b_based_on_required()
        {
            instance.Require(REQUIRE);
            ITypeFilter typeFilter = instance.CreateTypeFilter();

            Assert.True(typeFilter.Matches(ITEM_B));
        }
Exemplo n.º 10
0
        public void doesnt_match_based_on_noneOf()
        {
            instance.NoneOf(NONE_OF);
            ITypeFilter typeFilter = instance.CreateTypeFilter();

            Assert.False(typeFilter.Matches(ITEM_C));
        }