Пример #1
0
        public void SetUp()
        {
            thePredicate = new ChainPredicate();

            filter1 = MockRepository.GenerateMock <IChainFilter>();
            filter2 = MockRepository.GenerateMock <IChainFilter>();
            filter3 = MockRepository.GenerateMock <IChainFilter>();
            filter4 = MockRepository.GenerateMock <IChainFilter>();

            thePredicate.Matching(filter1);
            thePredicate.Matching(filter2);
            thePredicate.Matching(filter3);
            thePredicate.Matching(filter4);

            aChain = new BehaviorChain();
        }
        public AuthenticationSettings()
        {
            _exclusions.Matching <NotAuthenticatedFilter>();
            _exclusions.Matching <ExcludePassThroughAuthentication>();

            _passthroughChains.Matching <IncludePassThroughAuthentication>();

            ExpireInMinutes   = 180;
            SlidingExpiration = true;

            MaximumNumberOfFailedAttempts = 3;
            CooloffPeriodInMinutes        = 60;
            MembershipEnabled             = MembershipStatus.Enabled;

            _strategies = new AuthenticationChain();
        }
Пример #3
0
        public void matches_with_and_positive()
        {
            var predicate = new ChainPredicate();
            predicate.Matching(filter1).And.Matching(filter2);

            filter1.Stub(x => x.Matches(aChain)).Return(true);
            filter2.Stub(x => x.Matches(aChain)).Return(true);

            predicate.As<IChainFilter>().Matches(aChain).ShouldBeTrue();
        }
Пример #4
0
        public void mixed_and_and_or_3()
        {
            var predicate = new ChainPredicate();

            predicate.Matching(filter1).Or.Matching(filter2).And.Matching(filter3);
            predicate.As <IChainFilter>().Matches(aChain).ShouldBeFalse();

            filter1.Stub(x => x.Matches(aChain)).Return(true);

            predicate.As <IChainFilter>().Matches(aChain).ShouldBeTrue();
        }
Пример #5
0
        public void matches_with_and_positive()
        {
            var predicate = new ChainPredicate();

            predicate.Matching(filter1).And.Matching(filter2);


            filter1.Stub(x => x.Matches(aChain)).Return(true);
            filter2.Stub(x => x.Matches(aChain)).Return(true);

            predicate.As <IChainFilter>().Matches(aChain).ShouldBeTrue();
        }
Пример #6
0
        public void three_wide_and()
        {
            var predicate = new ChainPredicate();

            predicate.Matching(filter1).And.Matching(filter2).And.Matching(filter3);

            filter1.Stub(x => x.Matches(aChain)).Return(true);
            filter2.Stub(x => x.Matches(aChain)).Return(true);

            predicate.As <IChainFilter>().Matches(aChain).ShouldBeFalse();

            filter3.Stub(x => x.Matches(aChain)).Return(true);

            predicate.As <IChainFilter>().Matches(aChain).ShouldBeTrue();
        }
Пример #7
0
        public void mixed_and_and_ors_1()
        {
            var predicate = new ChainPredicate();
            predicate.Matching(filter1).And.Matching(filter2).Or.Matching(filter3);

            predicate.As<IChainFilter>().Matches(aChain).ShouldBeFalse();

            filter1.Stub(x => x.Matches(aChain)).Return(true);

            predicate.As<IChainFilter>().Matches(aChain).ShouldBeFalse();

            filter2.Stub(x => x.Matches(aChain)).Return(true);

            predicate.As<IChainFilter>().Matches(aChain).ShouldBeTrue();
        }
Пример #8
0
        public void SetUp()
        {
            thePredicate = new ChainPredicate();

            filter1 = MockRepository.GenerateMock<IChainFilter>();
            filter2 = MockRepository.GenerateMock<IChainFilter>();
            filter3 = MockRepository.GenerateMock<IChainFilter>();
            filter4 = MockRepository.GenerateMock<IChainFilter>();

            thePredicate.Matching(filter1);
            thePredicate.Matching(filter2);
            thePredicate.Matching(filter3);
            thePredicate.Matching(filter4);

            aChain = new BehaviorChain();
        }