Esempio n. 1
0
            public async Task Put_CalledDifferentMethod_NotFoundReturned()
            {
                using var sut = new ApiStub();

                sut.Put("/testput", (req, args) => "testresponse");

                sut.Start();

                var result = await httpClient.PostAsync(
                    new UriBuilder(new Uri(sut.Address)) { Path = "/testput" }.Uri,
                    new StringContent(""));

                Assert.Equal(HttpStatusCode.NotFound, result.StatusCode);
            }
Esempio n. 2
0
            public async Task Put_CalledSetupRoute_SetupResponseReturned()
            {
                using var sut = new ApiStub();

                sut.Put("/testput", (req, args) => "testresponse");

                sut.Start();

                var result = await httpClient.PutAsync(
                    new UriBuilder(new Uri(sut.Address)) { Path = "/testput" }.Uri,
                    new StringContent(""));

                Assert.Equal(HttpStatusCode.OK, result.StatusCode);

                var resultString = await result.Content.ReadAsStringAsync();

                Assert.Equal("testresponse", resultString);
            }