コード例 #1
0
        private static RouteContext GetRouteContext(Action <RouteSpecBuilder> configure)
        {
            var builder = new RouteSpecBuilder();

            configure(builder);
            var spec = builder.Build();

            return(RouteContextBuilder.FromUrl("/").WithSpec(spec).Build());
        }
コード例 #2
0
        public void CanTakeTargetAddressFromSpec()
        {
            var spec = new RouteSpecBuilder().WithServer("http://test").Build();
            var ctx  = RouteContextBuilder.FromUrl("/").WithSpec(spec).Build();

            var expected = new ResponseContext
            {
                StatusCode  = HttpStatusCode.OK,
                Body        = "",
                ContentType = "application/json; charset=utf-8",
                Headers     = { { "Content-Type", "application/json; charset=utf-8" } }
            };

            var actual = Sut(null).HandleAsync(ctx).Result?.RemoveSystemHeader();

            DeepAssert.Equal(expected, actual);
        }