public void MarkAsCompleted(DateTime dateOfCompletion) { if (this.DateOfStart > dateOfCompletion) { throw new ArgumentException("The date of completion cannot precede the date of start.", "dateOfCompletion"); } if (this.IsCompleted) { throw new InvalidOperationException("The Job Order has already been marked as completed"); } var @event = new TimeAndMaterialJobOrderCompletedEvent( this.Id, dateOfCompletion ); RaiseEvent(@event); }
public void Apply(TimeAndMaterialJobOrderCompletedEvent evt) { this.DateOfCompletion = evt.DateOfCompletion; this.IsCompleted = true; }