コード例 #1
0
        public void get_single_returns_expected_response()
        {
            var expectedBody = "foo-body";

            var sut = new EngineBuilder().Build();

            sut.RegisterHandler(new HandlerDefinition
            {
                HttpVerb     = HttpVerbs.Get,
                ResourceName = "foo",
                Handler      = request => HandlerResult.FromResult(expectedBody)
            });

            var response = sut.GetResponseFor(ResourceRequest.Get("/foo/1"));

            Assert.Equal(
                expected: ResourceResponse.Ok(expectedBody),
                actual: response,
                comparer: new StatusCodeAndBodyComparer()
                );
        }