Ejemplo n.º 1
0
    public async Task GetScenarioState_ShouldDeleteScenario()
    {
        // Arrange
        const string scenario = "scenario-1";
        var          client   = new HttPlaceholderClient(CreateHttpClient(mock => mock
                                                                          .When(HttpMethod.Delete, $"{BaseUrl}ph-api/scenarios/{scenario}")
                                                                          .Respond(HttpStatusCode.NoContent)));

        // Act / Assert
        await client.DeleteScenarioAsync(scenario);
    }
Ejemplo n.º 2
0
    public async Task DeleteScenario_ExceptionInRequest_ShouldThrowHttPlaceholderClientException()
    {
        // Arrange
        const string scenario = "scenario-1";
        var          client   = new HttPlaceholderClient(CreateHttpClient(mock => mock
                                                                          .When(HttpMethod.Delete, $"{BaseUrl}ph-api/scenarios/{scenario}")
                                                                          .Respond(HttpStatusCode.BadRequest, "text/plain", "Error occurred!")));

        // Act
        var exception =
            await Assert.ThrowsExceptionAsync <HttPlaceholderClientException>(() =>
                                                                              client.DeleteScenarioAsync(scenario));

        // Assert
        Assert.AreEqual("Status code '400' returned by HttPlaceholder with message 'Error occurred!'",
                        exception.Message);
    }