Exemple #1
0
        public async Task should_accessing_request()
        {
            HttpServer server = HttpServerTestHelper.PrepareHttpServer(
                ControllerAssemblies,
                new HttpRoute("AccessingRequestController", "Get", HttpMethod.Get, "resource"));

            using (server)
                using (var client = new HttpClient(server))
                {
                    await HttpServerTestHelper.AssertStringContent(
                        client,
                        "http://www.base.com/resource",
                        "client is accessing http://www.base.com/resource.");
                }
        }
        public async Task should_get_first_matched_route()
        {
            HttpServer httpServer = HttpServerTestHelper.PrepareHttpServer(
                ControllerAssemblies,
                new HttpRoute(
                    "ControllerWith2DifferentActions",
                    "GetResource1",
                    HttpMethod.Get,
                    "resource"),
                new HttpRoute(
                    "ControllerWith2DifferentActions",
                    "GetResource2",
                    HttpMethod.Get,
                    "resource"));

            using (httpServer)
                using (var client = new HttpClient(httpServer))
                {
                    await HttpServerTestHelper.AssertStringContent(client, "http://www.base.com/resource", "get resource 1");
                }
        }