Functional test is added that partially tests CompleteOrderAsync action

This commit is contained in:
hsn 2023-07-08 12:46:39 +03:00
parent ba8bbe71df
commit 979d4ff01d
2 changed files with 16 additions and 2 deletions

View File

@ -50,6 +50,7 @@ public class OrderingScenarioBase
{
public static string CancelOrder = "api/v1/orders/cancel";
public static string ShipOrder = "api/v1/orders/ship";
public static string CompleteOrder = "api/v1/orders/complete";
}
private class AuthStartupFilter : IStartupFilter

View File

@ -19,6 +19,20 @@ namespace Ordering.FunctionalTests
response.EnsureSuccessStatusCode();
}
[Fact]
public async Task Complete_order_no_order_created_bad_request_response()
{
using var server = CreateServer();
var content = new StringContent(BuildOrder(), UTF8Encoding.UTF8, "application/json")
{
Headers = { { "x-requestid", Guid.NewGuid().ToString() } }
};
var response = await server.CreateClient()
.PutAsync(Put.CompleteOrder, content);
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
}
[Fact]
public async Task Cancel_order_no_order_created_bad_request_response()
{
@ -29,8 +43,7 @@ namespace Ordering.FunctionalTests
};
var response = await server.CreateClient()
.PutAsync(Put.CancelOrder, content);
var s = await response.Content.ReadAsStringAsync();
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
}