public void TransferShipmentToCargoBay(string shipmentName, InventoryShipment shipment) { ThrowExceptionIfNotOpenFactory(); //Print("?> Command: transfer shipment to cargo bay"); if (_state.ListOfEmployeeNames.Count == 0) throw DomainError.Named("unknown-employee", ":> There has to be somebody at factory in order to accept shipment"); if (shipment.Cargo.Length == 0) throw DomainError.Named("empty-InventoryShipments", ":> Empty InventoryShipments are not accepted!"); if (_state.ShipmentsWaitingToBeUnloaded.Count >= 2) throw DomainError.Named("more-than-two-InventoryShipments", ":> More than two InventoryShipments can't fit into this cargo bay :("); DoRealWork("opening cargo bay doors"); Apply(new ShipmentTransferredToCargoBay(_state.Id, shipment)); var totalCountOfParts = shipment.Cargo.Sum(p => p.Quantity); if (totalCountOfParts > 10) { Apply(new CurseWordUttered(_state.Id, "Boltov tebe v korobky peredach", "awe in the face of the amount of shipment delivered")); } }