Exemplo n.º 1
0
        public void Should_apply_all_response_transforms_in_order()
        {
            Execute().Response.Should().BeSameAs(response3);

            Received.InOrder(
                () =>
            {
                transform1.Transform(response1);
                transform2.Transform(response2);
            });
        }
Exemplo n.º 2
0
        public void TestSetup()
        {
            context = Substitute.For <IRequestContext>();
            context.Request.Returns(Request.Get("foo/bar"));

            response1 = new Response(ResponseCode.Ok);
            response2 = new Response(ResponseCode.Ok);
            response3 = new Response(ResponseCode.Ok);

            initialResult = new ClusterResult(ClusterResultStatus.Success, new List <ReplicaResult>(), response1, context.Request);
            nextModule    = _ => Task.FromResult(initialResult);

            transform1 = Substitute.For <IResponseTransform>();
            transform1.Transform(Arg.Any <Response>()).Returns(response2);

            transform2 = Substitute.For <IResponseTransform>();
            transform2.Transform(Arg.Any <Response>()).Returns(response3);

            transforms = new List <IResponseTransform> {
                transform1, transform2
            };

            module = new ResponseTransformationModule(transforms);
        }