Beispiel #1
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);
        }
Beispiel #2
0
 /// <summary>
 /// Adds given <paramref name="transform"/> to configuration's <see cref="IClusterClientConfiguration.ResponseTransforms"/> list.
 /// </summary>
 public static void AddResponseTransform(this IClusterClientConfiguration configuration, IResponseTransform transform)
 {
     (configuration.ResponseTransforms ?? (configuration.ResponseTransforms = new List <IResponseTransform>())).Add(transform);
 }