Exemplo n.º 1
0
        public void TestSetup()
        {
            replicas = new[]
            {
                new Uri("http://host1/"),
                new Uri("http://host2/")
            };

            request    = Request.Get("foo/bar");
            budget     = Budget.WithRemaining(5.Minutes());
            parameters = RequestParameters.Empty.WithConnectionTimeout(1.Seconds());
            result     = new ReplicaResult(replicas[0], new Response(ResponseCode.NotFound), ResponseVerdict.Accept, TimeSpan.Zero);

            sender = Substitute.For <IRequestSender>();
            sender.SendToReplicaAsync(null, null, parameters.ConnectionTimeout, TimeSpan.Zero, Arg.Any <CancellationToken>()).ReturnsForAnyArgs(_ => result);

            strategy = new SingleReplicaRequestStrategy();
        }
        public void SetUp()
        {
            replicas = new[]
            {
                new Uri("http://host1/"),
                new Uri("http://host2/")
            };

            request = Request.Get("foo/bar");
            budget  = Budget.WithRemaining(5.Minutes());
            result  = new ReplicaResult(replicas[0], new Response(ResponseCode.NotFound), ResponseVerdict.Accept, TimeSpan.Zero);

            sender = Substitute.For <IRequestSender>();
            // ReSharper disable AssignNullToNotNullAttribute
            sender.SendToReplicaAsync(null, null, TimeSpan.Zero, Arg.Any <CancellationToken>()).ReturnsForAnyArgs(_ => result);
            // ReSharper restore AssignNullToNotNullAttribute

            strategy = new SingleReplicaRequestStrategy();
        }