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); }
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); }