Пример #1
0
        public void Setup()
        {
            IActionResult serializationResult = new OkResult();

            this.httpCaller = new RpcHttpFunction(new RpcHttpFunctionOptions
            {
                DeserializeRequest = (r, ct) => Task.FromResult(new object()),
                SerializeResponse  = (r, ct) => Task.FromResult(serializationResult)
            }, new FakeRpcRequestRunner());

            this.httpRequest = new FakeHttpRequest();
        }
Пример #2
0
        public void Setup()
        {
            var requests = this.requestFactory.TakeRequestTypes(RegistratedRequestsCount).ToList();

            var requestToProcess = requests[RegistratedRequestsCount / 2];

            this.requestName = requestToProcess.Name;

            var runner = new RpcRequestRunner(
                // As MediatR-RPC only use the non-generic MediatR api, we can just return any type.
                // Doesn't have to match the corresponding in request and it will not effect the benchmarking.
                new FakeSender(new RpcBenchmarkResponse()),
                new RpcOptions()
                .UseExactRequestTypeNameMatchingConvention()
                .ScanRequests(requests));

            this.httpCaller = new RpcHttpFunction(
                new RpcHttpFunctionOptions()
                .UseNewtonsoftJsonForDeserializeBody()
                .UseOkorNotFoundActionResults(),
                runner);

            this.httpRequest = new FakeHttpRequest();
        }