예제 #1
0
        public void invoke_happy_path_with_a_continuation_filter()
        {
            theChain.AddFilter(new StubBehaviorInvocationFilter(DoNext.Continue));

            theInvoker.Invoke(theArguments, theRouteData);
            theBehavior.AssertWasCalled(x => x.Invoke());
        }
예제 #2
0
        public static void ApplyCompression(this BehaviorChain chain, params IHttpContentEncoding[] encodings)
        {
            if (chain.Calls.Any(x => x.HasAttribute <DoNotCompressAttribute>()))
            {
                return;
            }

            if (encodings.Any())
            {
                var filter = new HttpContentEncodingFilter(new HttpContentEncoders(encodings));
                chain.AddFilter(filter);
            }
            else
            {
                chain.AddFilter(DefaultFilter);
            }
        }
예제 #3
0
        public void Modify(BehaviorChain chain)
        {
            if (chain.Calls.Any(x => x.HasAttribute<DoNotCompressAttribute>()))
            {
                return;
            }

            chain.AddFilter(_filter);
        }
예제 #4
0
        public void Modify(BehaviorChain chain)
        {
            if (chain.Calls.Any(x => x.HasAttribute <DoNotCompressAttribute>()))
            {
                return;
            }

            chain.AddFilter(_filter);
        }
예제 #5
0
        public void adding_a_filter_logs()
        {
            var filter = MockRepository.GenerateMock <IBehaviorInvocationFilter>();

            var chain = new BehaviorChain();

            chain.AddFilter(filter);

            chain.As <ITracedModel>().StagedEvents.OfType <FilterAdded>().Single().ShouldEqual(new FilterAdded(filter));
        }
예제 #6
0
        public void adding_a_filter_logs()
        {
            var filter = MockRepository.GenerateMock<IBehaviorInvocationFilter>();

            var chain = new BehaviorChain();
            chain.AddFilter(filter);

            chain.As<ITracedModel>().StagedEvents.OfType<FilterAdded>().Single().ShouldEqual(new FilterAdded(filter));
        }