示例#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());
        }
        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));
        }