Skip to content

Instantly share code, notes, and snippets.

Last active November 16, 2023 19:01
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
public void ShipProduct(int quantity)
// Trivial Validation
if (quantity <= 0)
throw new InvalidDomainException("Quantity must be greater than zero.");
// Business Rule
if (quantity > _warehouseProductState.QuantityOnHand)
throw new InvalidDomainException("Cannot Ship to a negative Quantity on Hand.");
var productShipped = new ProductShipped(Sku, quantity, DateTime.UtcNow);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment