public async Task DeleteStateAsync_CanDeleteState() { var httpClient = new TestHttpClient(); var client = new StateHttpClient(httpClient, new JsonSerializerOptions()); var task = client.DeleteStateAsync("testStore", "test"); httpClient.Requests.TryDequeue(out var entry).Should().BeTrue(); entry.Request.RequestUri.ToString().Should().Be(DeleteStateUrl(3500, "testStore", "test")); entry.Respond(new HttpResponseMessage(HttpStatusCode.OK)); await task; }
public async Task DeleteStateAsync_ThrowsForNonSuccess() { var httpClient = new TestHttpClient(); var client = new StateHttpClient(httpClient, new JsonSerializerOptions()); var task = client.DeleteStateAsync("testStore", "test"); httpClient.Requests.TryDequeue(out var entry).Should().BeTrue(); entry.Request.RequestUri.ToString().Should().Be(DeleteStateUrl(3500, "testStore", "test")); entry.Respond(new HttpResponseMessage(HttpStatusCode.NotAcceptable)); await FluentActions.Awaiting(async() => await task).Should().ThrowAsync <HttpRequestException>(); }