diff --git a/Core.Testing/Core.Testing.csproj b/Core.Testing/Core.Testing.csproj
index b0c564c4c..e475fdc87 100644
--- a/Core.Testing/Core.Testing.csproj
+++ b/Core.Testing/Core.Testing.csproj
@@ -6,6 +6,7 @@
+
@@ -14,7 +15,7 @@
-
+
diff --git a/Sample/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/AddingProduct/AddProductTests.cs b/Sample/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/AddingProduct/AddProductTests.cs
index c4b8cb08a..be5aa0477 100644
--- a/Sample/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/AddingProduct/AddProductTests.cs
+++ b/Sample/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/AddingProduct/AddProductTests.cs
@@ -22,6 +22,7 @@ public async Task InitializeAsync()
);
await CREATED(openResponse);
+ await RESPONSE_LOCATION_HEADER()(openResponse);
ShoppingCartId = openResponse.GetCreatedId();
}
diff --git a/Sample/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/Canceling/CancelShoppingCartTests.cs b/Sample/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/Canceling/CancelShoppingCartTests.cs
index bafaa48bb..6b2baafac 100644
--- a/Sample/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/Canceling/CancelShoppingCartTests.cs
+++ b/Sample/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/Canceling/CancelShoppingCartTests.cs
@@ -20,7 +20,7 @@ public async Task InitializeAsync()
new ApiRequest(POST, URI("/api/ShoppingCarts"), BODY(new OpenShoppingCartRequest(ClientId)))
);
- await CREATED(openResponse);
+ await CREATED_WITH_DEFAULT_HEADERS(eTag: 1)(openResponse);
ShoppingCartId = openResponse.GetCreatedId();
}
diff --git a/Sample/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/Confirming/ConfirmShoppingCartTests.cs b/Sample/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/Confirming/ConfirmShoppingCartTests.cs
index df21441d6..feedcf0cb 100644
--- a/Sample/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/Confirming/ConfirmShoppingCartTests.cs
+++ b/Sample/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/Confirming/ConfirmShoppingCartTests.cs
@@ -20,7 +20,7 @@ public async Task InitializeAsync()
new ApiRequest(POST, URI("/api/ShoppingCarts"), BODY(new OpenShoppingCartRequest(ClientId)))
);
- await CREATED(openResponse);
+ await CREATED_WITH_DEFAULT_HEADERS(eTag: 1)(openResponse);
ShoppingCartId = openResponse.GetCreatedId();
}
diff --git a/Sample/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/Opening/OpenShoppingCartTests.cs b/Sample/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/Opening/OpenShoppingCartTests.cs
index 584b341fe..92c404b3b 100644
--- a/Sample/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/Opening/OpenShoppingCartTests.cs
+++ b/Sample/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/Opening/OpenShoppingCartTests.cs
@@ -3,16 +3,14 @@
using Carts.ShoppingCarts.GettingCartById;
using Carts.ShoppingCarts.Products;
using Core.Testing;
-using Ogooreck.API;
using Xunit;
+using Ogooreck.API;
using static Ogooreck.API.ApiSpecification;
namespace Carts.Api.Tests.ShoppingCarts.Opening;
public class OpenShoppingCartTests: IClassFixture>
{
- private readonly ApiSpecification API;
-
[Fact]
public Task Post_ShouldReturn_CreatedStatus_With_CartId() =>
API.Scenario(
@@ -21,7 +19,7 @@ public Task Post_ShouldReturn_CreatedStatus_With_CartId() =>
BODY(new OpenShoppingCartRequest(ClientId))
)
.When(POST)
- .Then(CREATED),
+ .Then(CREATED_WITH_DEFAULT_HEADERS(eTag: 1)),
response =>
API.Given(
@@ -43,5 +41,6 @@ public Task Post_ShouldReturn_CreatedStatus_With_CartId() =>
public OpenShoppingCartTests(TestWebApplicationFactory fixture) =>
API = ApiSpecification.Setup(fixture);
- public readonly Guid ClientId = Guid.NewGuid();
+ private readonly ApiSpecification API;
+ private readonly Guid ClientId = Guid.NewGuid();
}
diff --git a/Sample/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/RemovingProduct/RemoveProductTests.cs b/Sample/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/RemovingProduct/RemoveProductTests.cs
index cb34d1a40..f39e8b84b 100644
--- a/Sample/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/RemovingProduct/RemoveProductTests.cs
+++ b/Sample/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/RemovingProduct/RemoveProductTests.cs
@@ -24,7 +24,7 @@ public async Task InitializeAsync()
new ApiRequest(POST, URI("/api/ShoppingCarts"), BODY(new OpenShoppingCartRequest(ClientId)))
);
- await CREATED(openResponse);
+ await CREATED_WITH_DEFAULT_HEADERS(eTag: 1)(openResponse);
ShoppingCartId = openResponse.GetCreatedId();
diff --git a/Sample/ECommerce/Orders/Orders.Api.Tests/Orders/InitializingOrder/InitializeOrderTests.cs b/Sample/ECommerce/Orders/Orders.Api.Tests/Orders/InitializingOrder/InitializeOrderTests.cs
index dacda4936..69110b10a 100644
--- a/Sample/ECommerce/Orders/Orders.Api.Tests/Orders/InitializingOrder/InitializeOrderTests.cs
+++ b/Sample/ECommerce/Orders/Orders.Api.Tests/Orders/InitializingOrder/InitializeOrderTests.cs
@@ -29,7 +29,7 @@ public Task InitializeOrder_ShouldReturn_CreatedStatus_With_OrderId() =>
))
)
.When(POST)
- .Then(CREATED);
+ .Then(CREATED_WITH_DEFAULT_HEADERS(eTag: 1));
private readonly Guid ClientId = Guid.NewGuid();
diff --git a/Sample/ECommerce/Payments/Payments.Api.Tests/Payments/RequestingPayment/RequestPaymentsTests.cs b/Sample/ECommerce/Payments/Payments.Api.Tests/Payments/RequestingPayment/RequestPaymentsTests.cs
index 0797748e2..549bb5d68 100644
--- a/Sample/ECommerce/Payments/Payments.Api.Tests/Payments/RequestingPayment/RequestPaymentsTests.cs
+++ b/Sample/ECommerce/Payments/Payments.Api.Tests/Payments/RequestingPayment/RequestPaymentsTests.cs
@@ -25,7 +25,7 @@ public Task RequestPayment_ShouldReturn_CreatedStatus_With_PaymentId() =>
BODY(new RequestPaymentRequest {OrderId = OrderId, Amount = Amount})
)
.When(POST)
- .Then(CREATED);
+ .Then(CREATED_WITH_DEFAULT_HEADERS(eTag: 1));
private readonly Guid OrderId = Guid.NewGuid();
diff --git a/Sample/ECommerce/Shipments/Shipments.Api.Tests/Packages/SendPackageTests.cs b/Sample/ECommerce/Shipments/Shipments.Api.Tests/Packages/SendPackageTests.cs
index 99d91ede1..93a852b21 100644
--- a/Sample/ECommerce/Shipments/Shipments.Api.Tests/Packages/SendPackageTests.cs
+++ b/Sample/ECommerce/Shipments/Shipments.Api.Tests/Packages/SendPackageTests.cs
@@ -27,7 +27,7 @@ public Task SendPackage_ShouldReturn_CreatedStatus_With_PackageId() =>
BODY(new SendPackage(OrderId, ProductItems))
)
.When(POST)
- .Then(CREATED)
+ .Then(CREATED_WITH_DEFAULT_HEADERS())
.And(response => fixture.ShouldPublishInternalEventOfType(
@event =>
@event.PackageId == response.GetCreatedId()
diff --git a/Sample/EventStoreDB/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/AddingProduct/AddProductTests.cs b/Sample/EventStoreDB/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/AddingProduct/AddProductTests.cs
index 113715be0..b210ee418 100644
--- a/Sample/EventStoreDB/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/AddingProduct/AddProductTests.cs
+++ b/Sample/EventStoreDB/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/AddingProduct/AddProductTests.cs
@@ -21,7 +21,7 @@ public async Task InitializeAsync()
new ApiRequest(POST, URI("/api/ShoppingCarts"), BODY(new OpenShoppingCartRequest(ClientId)))
);
- await CREATED(openResponse);
+ await CREATED_WITH_DEFAULT_HEADERS(eTag: 0)(openResponse);
ShoppingCartId = openResponse.GetCreatedId();
}
diff --git a/Sample/EventStoreDB/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/Canceling/CancelShoppingCartTests.cs b/Sample/EventStoreDB/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/Canceling/CancelShoppingCartTests.cs
index 207050714..800553b6d 100644
--- a/Sample/EventStoreDB/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/Canceling/CancelShoppingCartTests.cs
+++ b/Sample/EventStoreDB/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/Canceling/CancelShoppingCartTests.cs
@@ -21,7 +21,7 @@ public async Task InitializeAsync()
new ApiRequest(POST, URI("/api/ShoppingCarts"), BODY(new OpenShoppingCartRequest(ClientId)))
);
- await CREATED(openResponse);
+ await CREATED_WITH_DEFAULT_HEADERS(eTag: 0)(openResponse);
ShoppingCartId = openResponse.GetCreatedId();
}
diff --git a/Sample/EventStoreDB/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/Confirming/ConfirmShoppingCartTests.cs b/Sample/EventStoreDB/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/Confirming/ConfirmShoppingCartTests.cs
index ded7ece87..cddc1fb59 100644
--- a/Sample/EventStoreDB/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/Confirming/ConfirmShoppingCartTests.cs
+++ b/Sample/EventStoreDB/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/Confirming/ConfirmShoppingCartTests.cs
@@ -21,7 +21,7 @@ public async Task InitializeAsync()
new ApiRequest(POST, URI("/api/ShoppingCarts"), BODY(new OpenShoppingCartRequest(ClientId)))
);
- await CREATED(openResponse);
+ await CREATED_WITH_DEFAULT_HEADERS(eTag: 0)(openResponse);
ShoppingCartId = openResponse.GetCreatedId();
}
diff --git a/Sample/EventStoreDB/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/Opening/OpenShoppingCartTests.cs b/Sample/EventStoreDB/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/Opening/OpenShoppingCartTests.cs
index 9509bb854..23dbe4270 100644
--- a/Sample/EventStoreDB/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/Opening/OpenShoppingCartTests.cs
+++ b/Sample/EventStoreDB/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/Opening/OpenShoppingCartTests.cs
@@ -22,7 +22,7 @@ public Task Post_ShouldReturn_CreatedStatus_With_CartId() =>
BODY(new OpenShoppingCartRequest(ClientId))
)
.When(POST)
- .Then(CREATED),
+ .Then(CREATED_WITH_DEFAULT_HEADERS(eTag: 0)),
response =>
API.Given(
diff --git a/Sample/EventStoreDB/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/RemovingProduct/RemoveProductTests.cs b/Sample/EventStoreDB/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/RemovingProduct/RemoveProductTests.cs
index 066ff2149..610cb24ac 100644
--- a/Sample/EventStoreDB/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/RemovingProduct/RemoveProductTests.cs
+++ b/Sample/EventStoreDB/ECommerce/Carts/Carts.Api.Tests/ShoppingCarts/RemovingProduct/RemoveProductTests.cs
@@ -25,7 +25,7 @@ public async Task InitializeAsync()
new ApiRequest(POST, URI("/api/ShoppingCarts"), BODY(new OpenShoppingCartRequest(ClientId)))
);
- await CREATED(openResponse);
+ await CREATED_WITH_DEFAULT_HEADERS(eTag: 0)(openResponse);
ShoppingCartId = openResponse.GetCreatedId();
diff --git a/Sample/EventStoreDB/Simple/ECommerce.Api.Tests/ShoppingCarts/AddingProduct/AddProductTests.cs b/Sample/EventStoreDB/Simple/ECommerce.Api.Tests/ShoppingCarts/AddingProduct/AddProductTests.cs
index 3cdfc3633..7fcc5affc 100644
--- a/Sample/EventStoreDB/Simple/ECommerce.Api.Tests/ShoppingCarts/AddingProduct/AddProductTests.cs
+++ b/Sample/EventStoreDB/Simple/ECommerce.Api.Tests/ShoppingCarts/AddingProduct/AddProductTests.cs
@@ -23,7 +23,7 @@ public async Task InitializeAsync()
new ApiRequest(POST, URI("/api/ShoppingCarts"), BODY(new OpenShoppingCartRequest(ClientId)))
);
- await CREATED(openResponse);
+ await CREATED_WITH_DEFAULT_HEADERS(eTag: 0)(openResponse);
ShoppingCartId = openResponse.GetCreatedId();
}
diff --git a/Sample/EventStoreDB/Simple/ECommerce.Api.Tests/ShoppingCarts/Canceling/CancelShoppingCartTests.cs b/Sample/EventStoreDB/Simple/ECommerce.Api.Tests/ShoppingCarts/Canceling/CancelShoppingCartTests.cs
index ba2d4b61a..6b94a793e 100644
--- a/Sample/EventStoreDB/Simple/ECommerce.Api.Tests/ShoppingCarts/Canceling/CancelShoppingCartTests.cs
+++ b/Sample/EventStoreDB/Simple/ECommerce.Api.Tests/ShoppingCarts/Canceling/CancelShoppingCartTests.cs
@@ -23,7 +23,7 @@ public async Task InitializeAsync()
new ApiRequest(POST, URI("/api/ShoppingCarts"), BODY(new OpenShoppingCartRequest(ClientId)))
);
- await CREATED(openResponse);
+ await CREATED_WITH_DEFAULT_HEADERS(eTag: 0)(openResponse);
ShoppingCartId = openResponse.GetCreatedId();
}
diff --git a/Sample/EventStoreDB/Simple/ECommerce.Api.Tests/ShoppingCarts/Confirming/ConfirmShoppingCartTests.cs b/Sample/EventStoreDB/Simple/ECommerce.Api.Tests/ShoppingCarts/Confirming/ConfirmShoppingCartTests.cs
index 500c5c9c1..b5e4a7299 100644
--- a/Sample/EventStoreDB/Simple/ECommerce.Api.Tests/ShoppingCarts/Confirming/ConfirmShoppingCartTests.cs
+++ b/Sample/EventStoreDB/Simple/ECommerce.Api.Tests/ShoppingCarts/Confirming/ConfirmShoppingCartTests.cs
@@ -23,7 +23,7 @@ public async Task InitializeAsync()
new ApiRequest(POST, URI("/api/ShoppingCarts"), BODY(new OpenShoppingCartRequest(ClientId)))
);
- await CREATED(openResponse);
+ await CREATED_WITH_DEFAULT_HEADERS(eTag: 0)(openResponse);
ShoppingCartId = openResponse.GetCreatedId();
}
diff --git a/Sample/EventStoreDB/Simple/ECommerce.Api.Tests/ShoppingCarts/Opening/OpenShoppingCartTests.cs b/Sample/EventStoreDB/Simple/ECommerce.Api.Tests/ShoppingCarts/Opening/OpenShoppingCartTests.cs
index ea7a2f87c..b8b07e100 100644
--- a/Sample/EventStoreDB/Simple/ECommerce.Api.Tests/ShoppingCarts/Opening/OpenShoppingCartTests.cs
+++ b/Sample/EventStoreDB/Simple/ECommerce.Api.Tests/ShoppingCarts/Opening/OpenShoppingCartTests.cs
@@ -23,7 +23,7 @@ public Task Post_ShouldReturn_CreatedStatus_With_CartId() =>
BODY(new OpenShoppingCartRequest(ClientId))
)
.When(POST)
- .Then(CREATED),
+ .Then(CREATED_WITH_DEFAULT_HEADERS(eTag: 0)),
response =>
API.Given(
diff --git a/Sample/EventStoreDB/Simple/ECommerce.Api.Tests/ShoppingCarts/RemovingProduct/RemoveProductTests.cs b/Sample/EventStoreDB/Simple/ECommerce.Api.Tests/ShoppingCarts/RemovingProduct/RemoveProductTests.cs
index efe32b60b..f834d2649 100644
--- a/Sample/EventStoreDB/Simple/ECommerce.Api.Tests/ShoppingCarts/RemovingProduct/RemoveProductTests.cs
+++ b/Sample/EventStoreDB/Simple/ECommerce.Api.Tests/ShoppingCarts/RemovingProduct/RemoveProductTests.cs
@@ -26,7 +26,7 @@ public async Task InitializeAsync()
new ApiRequest(POST, URI("/api/ShoppingCarts"), BODY(new OpenShoppingCartRequest(ClientId)))
);
- await CREATED(openResponse);
+ await CREATED_WITH_DEFAULT_HEADERS(eTag: 0)(openResponse);
ShoppingCartId = openResponse.GetCreatedId();
diff --git a/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/AcknowledgeResolutionIncidentTests.cs b/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/AcknowledgeResolutionIncidentTests.cs
new file mode 100644
index 000000000..b06933323
--- /dev/null
+++ b/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/AcknowledgeResolutionIncidentTests.cs
@@ -0,0 +1,40 @@
+using Helpdesk.Api.Incidents;
+using Helpdesk.Api.Tests.Incidents.Fixtures;
+using Xunit;
+using static Ogooreck.API.ApiSpecification;
+
+namespace Helpdesk.Api.Tests.Incidents;
+
+public class AcknowledgeResolutionIncidentTests: IClassFixture
+{
+ [Fact]
+ [Trait("Category", "Acceptance")]
+ public async Task ResolveCommand_Succeeds()
+ {
+ await API
+ .Given(
+ URI($"/api/customers/{API.CustomerId}/incidents/{API.IncidentId}/acknowledge"),
+ HEADERS(IF_MATCH(2))
+ )
+ .When(POST)
+ .Then(OK);
+
+ await API
+ .Given(URI($"/api/incidents/{API.IncidentId}"))
+ .When(GET)
+ .Then(
+ OK,
+ RESPONSE_BODY(
+ API.Details with
+ {
+ Status = IncidentStatus.ResolutionAcknowledgedByCustomer,
+ Version = 3
+ }
+ )
+ );
+ }
+
+ private readonly ApiWithResolvedIncident API;
+
+ public AcknowledgeResolutionIncidentTests(ApiWithResolvedIncident api) => API = api;
+}
diff --git a/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/AssignAgentTests.cs b/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/AssignAgentTests.cs
new file mode 100644
index 000000000..b0edc7b3b
--- /dev/null
+++ b/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/AssignAgentTests.cs
@@ -0,0 +1,40 @@
+using Helpdesk.Api.Tests.Incidents.Fixtures;
+using Xunit;
+using static Ogooreck.API.ApiSpecification;
+
+namespace Helpdesk.Api.Tests.Incidents;
+
+public class AssignAgentToIncidentTests: IClassFixture
+{
+ [Fact]
+ [Trait("Category", "Acceptance")]
+ public async Task AssignAgentCommand_ChangesIncidentCategory()
+ {
+ await API
+ .Given(
+ URI($"/api/agents/{agentId}/incidents/{API.IncidentId}/assign"),
+ HEADERS(IF_MATCH(1))
+ )
+ .When(POST)
+ .Then(OK);
+
+ await API
+ .Given(URI($"/api/incidents/{API.IncidentId}"))
+ .When(GET)
+ .Then(
+ OK,
+ RESPONSE_BODY(
+ API.Details with
+ {
+ AgentId = agentId,
+ Version = 2
+ }
+ )
+ );
+ }
+
+ private readonly Guid agentId = Guid.NewGuid();
+ private readonly ApiWithLoggedIncident API;
+
+ public AssignAgentToIncidentTests(ApiWithLoggedIncident api) => API = api;
+}
diff --git a/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/CategoriseIncidentTests.cs b/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/CategoriseIncidentTests.cs
new file mode 100644
index 000000000..66d85c2e5
--- /dev/null
+++ b/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/CategoriseIncidentTests.cs
@@ -0,0 +1,46 @@
+using Bogus;
+using Helpdesk.Api.Incidents;
+using Helpdesk.Api.Incidents.GetIncidentDetails;
+using Helpdesk.Api.Tests.Incidents.Fixtures;
+using Xunit;
+using static Ogooreck.API.ApiSpecification;
+
+namespace Helpdesk.Api.Tests.Incidents;
+
+public class CategoriseIncidentTests: IClassFixture
+{
+ [Fact]
+ [Trait("Category", "Acceptance")]
+ public async Task CategoriseCommand_ChangesIncidentCategory()
+ {
+ await API
+ .Given(
+ URI($"/api/agents/{agentId}/incidents/{API.IncidentId}/category"),
+ BODY(new CategoriseIncidentRequest(category)),
+ HEADERS(IF_MATCH(1))
+ )
+ .When(POST)
+ .Then(OK);
+
+ await API
+ .Given(URI($"/api/incidents/{API.IncidentId}"))
+ .When(GET)
+ .Then(
+ OK,
+ RESPONSE_BODY(
+ API.Details with
+ {
+ Category = category,
+ Version = 2
+ }
+ )
+ );
+ }
+
+ private readonly Guid agentId = Guid.NewGuid();
+ private readonly IncidentCategory category = new Faker().PickRandom();
+ private readonly ApiWithLoggedIncident API;
+
+ public CategoriseIncidentTests(ApiWithLoggedIncident api) => API = api;
+
+}
diff --git a/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/CloseIncidentTests.cs b/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/CloseIncidentTests.cs
new file mode 100644
index 000000000..026e01927
--- /dev/null
+++ b/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/CloseIncidentTests.cs
@@ -0,0 +1,40 @@
+using Helpdesk.Api.Incidents;
+using Helpdesk.Api.Tests.Incidents.Fixtures;
+using Xunit;
+using static Ogooreck.API.ApiSpecification;
+
+namespace Helpdesk.Api.Tests.Incidents;
+
+public class CloseIncidentTests: IClassFixture
+{
+ [Fact]
+ [Trait("Category", "Acceptance")]
+ public async Task ResolveCommand_Succeeds()
+ {
+ await API
+ .Given(
+ URI($"/api/agents/{API.AgentId}/incidents/{API.IncidentId}/close"),
+ HEADERS(IF_MATCH(3))
+ )
+ .When(POST)
+ .Then(OK);
+
+ await API
+ .Given(URI($"/api/incidents/{API.IncidentId}"))
+ .When(GET)
+ .Then(
+ OK,
+ RESPONSE_BODY(
+ API.Details with
+ {
+ Status = IncidentStatus.Closed,
+ Version = 4
+ }
+ )
+ );
+ }
+
+ private readonly ApiWithResolvedIncident API;
+
+ public CloseIncidentTests(ApiWithAcknowledgedIncident api) => API = api;
+}
diff --git a/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/Fixtures/ApiWithAcknowledgedIncident.cs b/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/Fixtures/ApiWithAcknowledgedIncident.cs
new file mode 100644
index 000000000..382c6bebe
--- /dev/null
+++ b/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/Fixtures/ApiWithAcknowledgedIncident.cs
@@ -0,0 +1,33 @@
+using Helpdesk.Api.Incidents;
+using Helpdesk.Api.Incidents.GetIncidentDetails;
+using Xunit;
+using static Ogooreck.API.ApiSpecification;
+
+namespace Helpdesk.Api.Tests.Incidents.Fixtures;
+
+public class ApiWithAcknowledgedIncident: ApiWithResolvedIncident
+{
+ public override async Task InitializeAsync()
+ {
+ await base.InitializeAsync();
+
+ await Given(
+ URI($"/api/customers/{CustomerId}/incidents/{IncidentId}/acknowledge"),
+ HEADERS(IF_MATCH(2))
+ )
+ .When(POST)
+ .Then(OK);
+
+ Details = new IncidentDetails(
+ IncidentId,
+ CustomerId,
+ IncidentStatus.ResolutionAcknowledgedByCustomer,
+ Array.Empty(),
+ null,
+ null,
+ null,
+ 3
+ );
+ }
+}
+
diff --git a/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/Fixtures/ApiWithLoggedIncident.cs b/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/Fixtures/ApiWithLoggedIncident.cs
new file mode 100644
index 000000000..e0fbcd8b5
--- /dev/null
+++ b/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/Fixtures/ApiWithLoggedIncident.cs
@@ -0,0 +1,54 @@
+using Bogus;
+using Helpdesk.Api.Incidents;
+using Helpdesk.Api.Incidents.GetIncidentDetails;
+using Ogooreck.API;
+using Xunit;
+using static Ogooreck.API.ApiSpecification;
+
+namespace Helpdesk.Api.Tests.Incidents.Fixtures;
+
+public class ApiWithLoggedIncident: ApiSpecification, IAsyncLifetime
+{
+ public virtual async Task InitializeAsync()
+ {
+ var response = await Given(
+ URI($"api/customers/{CustomerId}/incidents/"),
+ BODY(new LogIncidentRequest(Contact, IncidentDescription))
+ )
+ .When(POST)
+ .Then(CREATED_WITH_DEFAULT_HEADERS(locationHeaderPrefix: "/api/incidents/"));
+
+ IncidentId = response.GetCreatedId();
+
+ Details = new IncidentDetails(
+ IncidentId,
+ CustomerId,
+ IncidentStatus.Pending,
+ Array.Empty(),
+ null,
+ null,
+ null,
+ 1
+ );
+ }
+
+ public Guid IncidentId { get; set; }
+
+ public IncidentDetails Details { get; protected set; } = default!;
+
+ public readonly Guid CustomerId = Guid.NewGuid();
+
+ private readonly Contact Contact = new Faker().CustomInstantiator(
+ f => new Contact(
+ f.PickRandom(),
+ f.Name.FirstName(),
+ f.Name.LastName(),
+ f.Internet.Email(),
+ f.Phone.PhoneNumber()
+ )
+ ).Generate();
+
+ private readonly string IncidentDescription = new Bogus.DataSets.Lorem().Sentence();
+
+ public Task DisposeAsync() => Task.CompletedTask;
+}
diff --git a/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/Fixtures/ApiWithResolvedIncident.cs b/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/Fixtures/ApiWithResolvedIncident.cs
new file mode 100644
index 000000000..b0efb7e75
--- /dev/null
+++ b/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/Fixtures/ApiWithResolvedIncident.cs
@@ -0,0 +1,37 @@
+using Bogus;
+using Helpdesk.Api.Incidents;
+using Helpdesk.Api.Incidents.GetIncidentDetails;
+using static Ogooreck.API.ApiSpecification;
+
+namespace Helpdesk.Api.Tests.Incidents.Fixtures;
+
+public class ApiWithResolvedIncident: ApiWithLoggedIncident
+{
+ public override async Task InitializeAsync()
+ {
+ await base.InitializeAsync();
+
+ await Given(
+ URI($"/api/agents/{AgentId}/incidents/{IncidentId}/resolve"),
+ BODY(new ResolveIncidentRequest(resolutionType)),
+ HEADERS(IF_MATCH(1))
+ )
+ .When(POST)
+ .Then(OK);
+
+ Details = new IncidentDetails(
+ IncidentId,
+ CustomerId,
+ IncidentStatus.Resolved,
+ Array.Empty(),
+ null,
+ null,
+ null,
+ 2
+ );
+ }
+
+ public readonly Guid AgentId = Guid.NewGuid();
+ private readonly ResolutionType resolutionType = new Faker().PickRandom();
+}
+
diff --git a/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/LogIncidentsTests.cs b/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/LogIncidentsTests.cs
new file mode 100644
index 000000000..723043319
--- /dev/null
+++ b/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/LogIncidentsTests.cs
@@ -0,0 +1,62 @@
+using Bogus;
+using Bogus.DataSets;
+using Core.Testing;
+using Helpdesk.Api.Incidents;
+using Helpdesk.Api.Incidents.GetIncidentDetails;
+using Xunit;
+using Ogooreck.API;
+using static Ogooreck.API.ApiSpecification;
+
+namespace Helpdesk.Api.Tests.Incidents;
+
+public class LogIncidentsTests: IClassFixture>
+{
+ [Fact]
+ public Task LogIncident_ShouldSucceed() =>
+ API.Scenario(
+ // Log Incident
+ API.Given(
+ URI($"api/customers/{CustomerId}/incidents/"),
+ BODY(new LogIncidentRequest(Contact, IncidentDescription))
+ )
+ .When(POST)
+ .Then(CREATED_WITH_DEFAULT_HEADERS(locationHeaderPrefix: "/api/incidents/")),
+ // Get Details
+ response =>
+ API.Given(URI($"/api/incidents/{response.GetCreatedId()}"))
+ .When(GET)
+ .Then(
+ OK,
+ RESPONSE_BODY(
+ new IncidentDetails(
+ response.GetCreatedId(),
+ CustomerId,
+ IncidentStatus.Pending,
+ Array.Empty(),
+ null,
+ null,
+ null,
+ 1
+ )
+ )
+ )
+ );
+
+ public LogIncidentsTests(TestWebApplicationFactory fixture) =>
+ API = ApiSpecification.Setup(fixture);
+
+ private readonly ApiSpecification API;
+ private readonly Guid CustomerId = Guid.NewGuid();
+
+ private readonly Contact Contact = new Faker().CustomInstantiator(
+ f => new Contact(
+ f.PickRandom(),
+ f.Name.FirstName(),
+ f.Name.LastName(),
+ f.Internet.Email(),
+ f.Phone.PhoneNumber()
+ )
+ ).Generate();
+
+ private readonly string IncidentDescription = new Lorem().Sentence();
+}
diff --git a/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/PrioritiseIncidentTests.cs b/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/PrioritiseIncidentTests.cs
new file mode 100644
index 000000000..eec4ce18a
--- /dev/null
+++ b/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/PrioritiseIncidentTests.cs
@@ -0,0 +1,46 @@
+using Bogus;
+using Helpdesk.Api.Incidents;
+using Helpdesk.Api.Incidents.GetIncidentDetails;
+using Helpdesk.Api.Tests.Incidents.Fixtures;
+using Xunit;
+using static Ogooreck.API.ApiSpecification;
+
+namespace Helpdesk.Api.Tests.Incidents;
+
+public class PrioritiseIncidentTests: IClassFixture
+{
+ [Fact]
+ [Trait("Category", "Acceptance")]
+ public async Task PrioritiseCommand_ChangesIncidentPriority()
+ {
+ await API
+ .Given(
+ URI($"/api/agents/{agentId}/incidents/{API.IncidentId}/priority"),
+ BODY(new PrioritiseIncidentRequest(priority)),
+ HEADERS(IF_MATCH(1))
+ )
+ .When(POST)
+ .Then(OK);
+
+ await API
+ .Given(URI($"/api/incidents/{API.IncidentId}"))
+ .When(GET)
+ .Then(
+ OK,
+ RESPONSE_BODY(
+ API.Details with
+ {
+ Priority = priority,
+ Version = 2
+ }
+ )
+ );
+ }
+
+ private readonly Guid agentId = Guid.NewGuid();
+ private readonly IncidentPriority priority = new Faker().PickRandom();
+ private readonly ApiWithLoggedIncident API;
+
+ public PrioritiseIncidentTests(ApiWithLoggedIncident api) => API = api;
+
+}
diff --git a/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/RecordAgentResponseToIncidentTests.cs b/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/RecordAgentResponseToIncidentTests.cs
new file mode 100644
index 000000000..a4bc75da5
--- /dev/null
+++ b/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/RecordAgentResponseToIncidentTests.cs
@@ -0,0 +1,50 @@
+using Bogus;
+using Bogus.DataSets;
+using Helpdesk.Api.Incidents;
+using Helpdesk.Api.Incidents.GetIncidentDetails;
+using Helpdesk.Api.Tests.Incidents.Fixtures;
+using Xunit;
+using static Ogooreck.API.ApiSpecification;
+
+namespace Helpdesk.Api.Tests.Incidents;
+
+public class RecordAgentResponseToIncidentTests: IClassFixture
+{
+ [Fact]
+ [Trait("Category", "Acceptance")]
+ public async Task RecordAgentResponseCommand_RecordsResponse()
+ {
+ await API
+ .Given(
+ URI($"/api/agents/{agentId}/incidents/{API.IncidentId}/responses"),
+ BODY(new RecordAgentResponseToIncidentRequest(content, visibleToCustomer)),
+ HEADERS(IF_MATCH(1))
+ )
+ .When(POST)
+ .Then(OK);
+
+ await API
+ .Given(URI($"/api/incidents/{API.IncidentId}"))
+ .When(GET)
+ .Then(
+ OK,
+ RESPONSE_BODY(
+ API.Details with
+ {
+ Notes = new[]
+ {
+ new IncidentNote(IncidentNoteType.FromAgent, agentId, content, visibleToCustomer)
+ },
+ Version = 2
+ }
+ )
+ );
+ }
+
+ private readonly Guid agentId = Guid.NewGuid();
+ private readonly string content = new Lorem().Sentence();
+ private readonly bool visibleToCustomer = new Faker().Random.Bool();
+ private readonly ApiWithLoggedIncident API;
+
+ public RecordAgentResponseToIncidentTests(ApiWithLoggedIncident api) => API = api;
+}
diff --git a/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/RecordCustomerResponseToIncidentTests.cs b/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/RecordCustomerResponseToIncidentTests.cs
new file mode 100644
index 000000000..aeea9dd53
--- /dev/null
+++ b/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/RecordCustomerResponseToIncidentTests.cs
@@ -0,0 +1,46 @@
+using Bogus;
+using Bogus.DataSets;
+using Helpdesk.Api.Incidents;
+using Helpdesk.Api.Incidents.GetIncidentDetails;
+using Helpdesk.Api.Tests.Incidents.Fixtures;
+using Xunit;
+using static Ogooreck.API.ApiSpecification;
+
+namespace Helpdesk.Api.Tests.Incidents;
+
+public class RecordCustomerResponseToIncidentTests: IClassFixture
+{
+ [Fact]
+ [Trait("Category", "Acceptance")]
+ public async Task RecordCustomerResponseCommand_RecordsResponse()
+ {
+ await API
+ .Given(
+ URI($"/api/customers/{customerId}/incidents/{API.IncidentId}/responses"),
+ BODY(new RecordCustomerResponseToIncidentRequest(content)),
+ HEADERS(IF_MATCH(1))
+ )
+ .When(POST)
+ .Then(OK);
+
+ await API
+ .Given(URI($"/api/incidents/{API.IncidentId}"))
+ .When(GET)
+ .Then(
+ OK,
+ RESPONSE_BODY(
+ API.Details with
+ {
+ Notes = new[] { new IncidentNote(IncidentNoteType.FromCustomer, customerId, content, true) },
+ Version = 2
+ }
+ )
+ );
+ }
+
+ private readonly Guid customerId = Guid.NewGuid();
+ private readonly string content = new Lorem().Sentence();
+ private readonly ApiWithLoggedIncident API;
+
+ public RecordCustomerResponseToIncidentTests(ApiWithLoggedIncident api) => API = api;
+}
diff --git a/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/ResolveIncidentTests.cs b/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/ResolveIncidentTests.cs
new file mode 100644
index 000000000..d139c25f1
--- /dev/null
+++ b/Sample/Helpdesk/Helpdesk.Api.Tests/Incidents/ResolveIncidentTests.cs
@@ -0,0 +1,46 @@
+using Bogus;
+using Bogus.DataSets;
+using Helpdesk.Api.Incidents;
+using Helpdesk.Api.Incidents.GetIncidentDetails;
+using Helpdesk.Api.Tests.Incidents.Fixtures;
+using Xunit;
+using static Ogooreck.API.ApiSpecification;
+
+namespace Helpdesk.Api.Tests.Incidents;
+
+public class ResolveIncidentTests: IClassFixture
+{
+ [Fact]
+ [Trait("Category", "Acceptance")]
+ public async Task ResolveCommand_Succeeds()
+ {
+ await API
+ .Given(
+ URI($"/api/agents/{agentId}/incidents/{API.IncidentId}/resolve"),
+ BODY(new ResolveIncidentRequest(resolutionType)),
+ HEADERS(IF_MATCH(1))
+ )
+ .When(POST)
+ .Then(OK);
+
+ await API
+ .Given(URI($"/api/incidents/{API.IncidentId}"))
+ .When(GET)
+ .Then(
+ OK,
+ RESPONSE_BODY(
+ API.Details with
+ {
+ Status = IncidentStatus.Resolved,
+ Version = 2
+ }
+ )
+ );
+ }
+
+ private readonly Guid agentId = Guid.NewGuid();
+ private readonly ResolutionType resolutionType = new Faker().PickRandom();
+ private readonly ApiWithLoggedIncident API;
+
+ public ResolveIncidentTests(ApiWithLoggedIncident api) => API = api;
+}
diff --git a/Sample/Helpdesk/Helpdesk.Api.Tests/Settings.cs b/Sample/Helpdesk/Helpdesk.Api.Tests/Settings.cs
new file mode 100644
index 000000000..217120083
--- /dev/null
+++ b/Sample/Helpdesk/Helpdesk.Api.Tests/Settings.cs
@@ -0,0 +1,3 @@
+using Xunit;
+
+[assembly: CollectionBehavior(DisableTestParallelization = true)]
diff --git a/Sample/Helpdesk/Helpdesk.Api/Helpdesk.Api.csproj b/Sample/Helpdesk/Helpdesk.Api/Helpdesk.Api.csproj
index ec1a20ec3..facba787c 100644
--- a/Sample/Helpdesk/Helpdesk.Api/Helpdesk.Api.csproj
+++ b/Sample/Helpdesk/Helpdesk.Api/Helpdesk.Api.csproj
@@ -2,8 +2,6 @@
net6.0
- enable
- enable
diff --git a/Sample/Helpdesk/Helpdesk.Api/Incidents/GetIncidentDetails/IncidentDetails.cs b/Sample/Helpdesk/Helpdesk.Api/Incidents/GetIncidentDetails/IncidentDetails.cs
index f8693ac9a..fd9f3e950 100644
--- a/Sample/Helpdesk/Helpdesk.Api/Incidents/GetIncidentDetails/IncidentDetails.cs
+++ b/Sample/Helpdesk/Helpdesk.Api/Incidents/GetIncidentDetails/IncidentDetails.cs
@@ -37,7 +37,7 @@ public IncidentDetails Apply(IncidentCategorised categorised, IncidentDetails cu
public IncidentDetails Apply(IncidentPrioritised prioritised, IncidentDetails current) =>
current with { Priority = prioritised.Priority };
- public IncidentDetails Apply(AgentAssigned prioritised, IncidentDetails current) =>
+ public IncidentDetails Apply(AgentAssignedToIncident prioritised, IncidentDetails current) =>
current with { AgentId = prioritised.AgentId };
public IncidentDetails Apply(AgentRespondedToIncident agentResponded, IncidentDetails current) =>
diff --git a/Sample/Helpdesk/Helpdesk.Api/Incidents/GetIncidentHistory/IncidentHistory.cs b/Sample/Helpdesk/Helpdesk.Api/Incidents/GetIncidentHistory/IncidentHistory.cs
index b6d0def42..8c483d569 100644
--- a/Sample/Helpdesk/Helpdesk.Api/Incidents/GetIncidentHistory/IncidentHistory.cs
+++ b/Sample/Helpdesk/Helpdesk.Api/Incidents/GetIncidentHistory/IncidentHistory.cs
@@ -45,7 +45,7 @@ public IncidentHistory Transform(IEvent input)
);
}
- public IncidentHistory Transform(IEvent input)
+ public IncidentHistory Transform(IEvent input)
{
var (incidentId, agentId, assignedAt) = input.Data;
diff --git a/Sample/Helpdesk/Helpdesk.Api/Incidents/Incident.cs b/Sample/Helpdesk/Helpdesk.Api/Incidents/Incident.cs
index f188d1b37..94dcd6908 100644
--- a/Sample/Helpdesk/Helpdesk.Api/Incidents/Incident.cs
+++ b/Sample/Helpdesk/Helpdesk.Api/Incidents/Incident.cs
@@ -23,7 +23,7 @@ public record IncidentPrioritised(
DateTimeOffset PrioritisedAt
);
-public record AgentAssigned(
+public record AgentAssignedToIncident(
Guid IncidentId,
Guid AgentId,
DateTimeOffset AssignedAt
diff --git a/Sample/Helpdesk/Helpdesk.Api/Incidents/IncidentDomainService.cs b/Sample/Helpdesk/Helpdesk.Api/Incidents/IncidentDomainService.cs
index 1379100bf..0274a16cd 100644
--- a/Sample/Helpdesk/Helpdesk.Api/Incidents/IncidentDomainService.cs
+++ b/Sample/Helpdesk/Helpdesk.Api/Incidents/IncidentDomainService.cs
@@ -20,7 +20,7 @@ public record PrioritiseIncident(
Guid PrioritisedBy
);
-public record AssignAgent(
+public record AssignAgentToIncident(
Guid IncidentId,
Guid AgentId
);
@@ -80,14 +80,14 @@ public static IncidentPrioritised Handle(Incident current, PrioritiseIncident co
return new IncidentPrioritised(incidentId, incidentPriority, prioritisedBy, DateTimeOffset.UtcNow);
}
- public static AgentAssigned Handle(Incident current, AssignAgent command)
+ public static AgentAssignedToIncident Handle(Incident current, AssignAgentToIncident command)
{
if (current.Status == IncidentStatus.Closed)
throw new InvalidOperationException("Incident is already closed");
var (incidentId, agentId) = command;
- return new AgentAssigned(incidentId, agentId, DateTimeOffset.UtcNow);
+ return new AgentAssignedToIncident(incidentId, agentId, DateTimeOffset.UtcNow);
}
public static AgentRespondedToIncident Handle(
diff --git a/Sample/Helpdesk/Helpdesk.Api/Program.cs b/Sample/Helpdesk/Helpdesk.Api/Program.cs
index ec7e1c366..480d3be84 100644
--- a/Sample/Helpdesk/Helpdesk.Api/Program.cs
+++ b/Sample/Helpdesk/Helpdesk.Api/Program.cs
@@ -84,7 +84,7 @@ CancellationToken ct
current => Handle(current, new PrioritiseIncident(incidentId, body.Priority, agentId)), ct)
).WithTags("Agent");
-app.MapPut("api/agents/{agentId:guid}/incidents/{incidentId:guid}/assign",
+app.MapPost("api/agents/{agentId:guid}/incidents/{incidentId:guid}/assign",
(
IDocumentSession documentSession,
Guid incidentId,
@@ -93,7 +93,7 @@ CancellationToken ct
CancellationToken ct
) =>
documentSession.GetAndUpdate(incidentId, ToExpectedVersion(eTag),
- current => Handle(current, new AssignAgent(incidentId, agentId)), ct)
+ current => Handle(current, new AssignAgentToIncident(incidentId, agentId)), ct)
).WithTags("Agent");
app.MapPost("api/customers/{customerId:guid}/incidents/{incidentId:guid}/responses/",
@@ -225,3 +225,7 @@ bool VisibleToCustomer
public record ResolveIncidentRequest(
ResolutionType Resolution
);
+
+public partial class Program
+{
+}
diff --git a/Sample/MeetingsManagement/MeetingsManagement.IntegrationTests/Meetings/CreatingMeeting/CreateMeetingTests.cs b/Sample/MeetingsManagement/MeetingsManagement.IntegrationTests/Meetings/CreatingMeeting/CreateMeetingTests.cs
index 8ee52777c..ae52957c0 100644
--- a/Sample/MeetingsManagement/MeetingsManagement.IntegrationTests/Meetings/CreatingMeeting/CreateMeetingTests.cs
+++ b/Sample/MeetingsManagement/MeetingsManagement.IntegrationTests/Meetings/CreatingMeeting/CreateMeetingTests.cs
@@ -25,7 +25,7 @@ public Task CreateCommand_ShouldPublish_MeetingCreateEvent() =>
BODY(new CreateMeeting(MeetingId, MeetingName))
)
.When(POST)
- .Then(CREATED);
+ .Then(CREATED_WITH_DEFAULT_HEADERS(eTag: 1));
private readonly Guid MeetingId = Guid.NewGuid();
private readonly string MeetingName = "Event Sourcing Workshop";
diff --git a/Sample/MeetingsManagement/MeetingsManagement.IntegrationTests/Meetings/SchedulingMeetings/ScheduleMeetingTests.cs b/Sample/MeetingsManagement/MeetingsManagement.IntegrationTests/Meetings/SchedulingMeetings/ScheduleMeetingTests.cs
index b39d2bd0d..4b5997384 100644
--- a/Sample/MeetingsManagement/MeetingsManagement.IntegrationTests/Meetings/SchedulingMeetings/ScheduleMeetingTests.cs
+++ b/Sample/MeetingsManagement/MeetingsManagement.IntegrationTests/Meetings/SchedulingMeetings/ScheduleMeetingTests.cs
@@ -17,7 +17,7 @@ public async Task InitializeAsync()
new ApiRequest(POST, URI(MeetingsManagementApi.MeetingsUrl), BODY(new CreateMeeting(MeetingId, MeetingName)))
);
- await CREATED(openResponse);
+ await CREATED_WITH_DEFAULT_HEADERS(eTag: 1)(openResponse);
}
public Task DisposeAsync() => Task.CompletedTask;
diff --git a/Sample/Tickets/Tickets.Api.Tests/Reservations/CreatingTentativeReservation/CreateTentativeReservationTests.cs b/Sample/Tickets/Tickets.Api.Tests/Reservations/CreatingTentativeReservation/CreateTentativeReservationTests.cs
index 4511fcfb8..3d3df96e8 100644
--- a/Sample/Tickets/Tickets.Api.Tests/Reservations/CreatingTentativeReservation/CreateTentativeReservationTests.cs
+++ b/Sample/Tickets/Tickets.Api.Tests/Reservations/CreatingTentativeReservation/CreateTentativeReservationTests.cs
@@ -26,7 +26,7 @@ await API.Scenario(
BODY(new CreateTentativeReservationRequest { SeatId = SeatId })
)
.When(POST)
- .Then(CREATED,
+ .Then(CREATED_WITH_DEFAULT_HEADERS(eTag: 1),
response =>
{
createdReservationId = response.GetCreatedId();
diff --git a/Sample/Warehouse/Warehouse.Api.Tests/Products/GettingProductDetails/GetProductDetailsTests.cs b/Sample/Warehouse/Warehouse.Api.Tests/Products/GettingProductDetails/GetProductDetailsTests.cs
index 2e1cd6270..6ba95543d 100644
--- a/Sample/Warehouse/Warehouse.Api.Tests/Products/GettingProductDetails/GetProductDetailsTests.cs
+++ b/Sample/Warehouse/Warehouse.Api.Tests/Products/GettingProductDetails/GetProductDetailsTests.cs
@@ -47,7 +47,7 @@ public async Task InitializeAsync()
new ApiRequest(POST, URI("/api/products"), BODY(registerProduct))
);
- await CREATED(registerResponse);
+ await CREATED_WITH_DEFAULT_HEADERS(eTag: 1)(registerResponse);
var (sku, name, description) = registerProduct;
ExistingProduct = new ProductDetails(registerResponse.GetCreatedId(), sku!, name!, description);
diff --git a/Sample/Warehouse/Warehouse.Api.Tests/Products/GettingProducts/GetProductsTests.cs b/Sample/Warehouse/Warehouse.Api.Tests/Products/GettingProducts/GetProductsTests.cs
index 1a4e596b2..2b750d90d 100644
--- a/Sample/Warehouse/Warehouse.Api.Tests/Products/GettingProducts/GetProductsTests.cs
+++ b/Sample/Warehouse/Warehouse.Api.Tests/Products/GettingProducts/GetProductsTests.cs
@@ -83,7 +83,7 @@ public async Task InitializeAsync()
new ApiRequest(POST, URI("/api/products"), BODY(registerProduct))
);
- await CREATED(registerResponse);
+ await CREATED_WITH_DEFAULT_HEADERS(eTag: 1)(registerResponse);
var createdId = registerResponse.GetCreatedId();
diff --git a/Sample/Warehouse/Warehouse.Api.Tests/Products/RegisteringProduct/RegisterProductTests.cs b/Sample/Warehouse/Warehouse.Api.Tests/Products/RegisteringProduct/RegisterProductTests.cs
index d2d521c85..2c99c7971 100644
--- a/Sample/Warehouse/Warehouse.Api.Tests/Products/RegisteringProduct/RegisterProductTests.cs
+++ b/Sample/Warehouse/Warehouse.Api.Tests/Products/RegisteringProduct/RegisterProductTests.cs
@@ -20,7 +20,7 @@ public Task ValidRequest_ShouldReturn_201(RegisterProductRequest validRequest) =
BODY(validRequest)
)
.When(POST)
- .Then(CREATED);
+ .Then(CREATED_WITH_DEFAULT_HEADERS(eTag: 1));
[Theory]
[MemberData(nameof(InvalidRequests))]
@@ -44,7 +44,7 @@ await API.Given(
BODY(request)
)
.When(POST)
- .Then(CREATED);
+ .Then(CREATED_WITH_DEFAULT_HEADERS(eTag: 1));
// second one will fail with conflict
await API.Given(