Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Last active March 4, 2019 16:07
  • 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
Embed
What would you like to do?
public class ShipmentCommand
{
private DateTime? _delivery;
private string _proofOfDelivery;
public ShipmentCommand(Guid shipmentID)
{
// Load current state
}
public void Deliver(DateTime delivery, string proofOfDelivery)
{
if (_delivery != null)
{
throw new InvalidOperationException("Already delivered.");
}
_delivery = delivery;
_proofOfDelivery = proofOfDelivery;
}
}
public class ShipmentQuery
{
private DateTime? _delivery;
public ShipmentQuery(Guid shipmentID)
{
// Load current state
}
public bool IsDelievered()
{
return _delivery.HasValue;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment