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 FixedPriceJobOrderCompletedEvent( this.Id, dateOfCompletion ); RaiseEvent(@event); }
public void Apply(FixedPriceJobOrderCompletedEvent evt) { this.DateOfCompletion = evt.DateOfCompletion; this.IsCompleted = true; }