Browse Source

Functional test is added that partially tests CompleteOrderAsync action

pull/2134/head
hsn 1 year ago
parent
commit
979d4ff01d
2 changed files with 16 additions and 2 deletions
  1. +1
    -0
      src/Services/Ordering/Ordering.FunctionalTests/OrderingScenarioBase.cs
  2. +15
    -2
      src/Services/Ordering/Ordering.FunctionalTests/OrderingScenarios.cs

+ 1
- 0
src/Services/Ordering/Ordering.FunctionalTests/OrderingScenarioBase.cs View File

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


+ 15
- 2
src/Services/Ordering/Ordering.FunctionalTests/OrderingScenarios.cs View File

@ -19,6 +19,20 @@ namespace Ordering.FunctionalTests
response.EnsureSuccessStatusCode(); 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] [Fact]
public async Task Cancel_order_no_order_created_bad_request_response() public async Task Cancel_order_no_order_created_bad_request_response()
{ {
@ -29,8 +43,7 @@ namespace Ordering.FunctionalTests
}; };
var response = await server.CreateClient() var response = await server.CreateClient()
.PutAsync(Put.CancelOrder, content); .PutAsync(Put.CancelOrder, content);
var s = await response.Content.ReadAsStringAsync();
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
} }


Loading…
Cancel
Save