public void TaskReactivatedEvent() { var taskId = Guid.NewGuid(); var e = new TaskReactivatedEvent() { TaskId = taskId }; var task = OTask.Factory.Create(taskId, "Fake"); task.ApplyEvent(e); Assert.Null(task.DateOfCancellation); Assert.Null(task.DateOfCompletion); }
public void Reactivate() { if (!this.DateOfCancellation.HasValue && !this.DateOfCompletion.HasValue) { throw new InvalidOperationException("Can't reactivate an already active task."); } var e = new TaskReactivatedEvent() { TaskId = this.Id }; RaiseEvent(e); }
public void ApplyEvent(TaskReactivatedEvent @event) { this.DateOfCancellation = null; this.DateOfCompletion = null; }