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

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

            chain.AddFilter(_filter);
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }