Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created November 16, 2023 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcomartin/60fe67ca764b272a7063635caf6ecae2 to your computer and use it in GitHub Desktop.
Save dcomartin/60fe67ca764b272a7063635caf6ecae2 to your computer and use it in GitHub Desktop.
public void ShipProduct(Quantity quantity)
{
if (quantity > _warehouseProductState.QuantityOnHand + QuantityBuffer)
{
throw new InvalidDomainException("Cannot Ship to a negative Quantity on Hand.");
}
var productShipped = new ProductShipped(Sku, quantity, DateTime.UtcNow);
Apply(productShipped);
Add(productShipped);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment