Beispiel #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);
            }
        }
Beispiel #3
0
        public void Modify(BehaviorChain chain)
        {
            if (chain.Calls.Any(x => x.HasAttribute<DoNotCompressAttribute>()))
            {
                return;
            }

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

            chain.AddFilter(_filter);
        }
Beispiel #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));
        }
        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));
        }