public void TestSetup()
        {
            request1 = Request.Get("/1");
            request2 = Request.Get("/2");
            request3 = Request.Get("/3");
            request4 = Request.Get("/4");
            request5 = Request.Get("/5");

            context = new RequestContext(request1, new RequestParameters(Strategy.SingleReplica), Budget.Infinite, new ConsoleLog(), null, int.MaxValue);

            transform1 = Substitute.For <IRequestTransform>();
            transform1.Transform(Arg.Any <Request>()).Returns(_ => request2);

            transform2 = Substitute.For <IRequestTransform>();
            transform2.Transform(Arg.Any <Request>()).Returns(_ => request3);

            transform3 = Substitute.For <IAsyncRequestTransform>();
            transform3.TransformAsync(Arg.Any <Request>()).Returns(_ => request4);

            transform4 = Substitute.For <IAsyncRequestTransform>();
            transform4.TransformAsync(Arg.Any <Request>()).Returns(_ => request5);

            transforms = new List <IRequestTransformMetadata> {
                transform1, transform2, transform3, transform4
            };

            module = new RequestTransformationModule(transforms);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Adds given <paramref name="transform"/> to configuration's <see cref="IClusterClientConfiguration.RequestTransforms"/> list.
 /// </summary>
 public static void AddRequestTransform(this IClusterClientConfiguration configuration, IAsyncRequestTransform transform)
 => AddRequestTransform(configuration, transform as IRequestTransformMetadata);