/// <exception cref="DeadlineIsInThePastException">Condition.</exception> public void ChangeDeadline(TaskDeadline deadline) { if (deadline.InThePast) { throw new DeadlineIsInThePastException(); } ApplyChange(new DeadlineOnTaskChanged(Id, deadline)); }
private void Apply(TaskRegistered @event) { Id = new TaskId(@event.TaskId); _projectId = new ProjectId(@event.ProjectId); _title = new Title(@event.Title); _priority = TaskPriority.Parse(@event.Priority); if (!string.IsNullOrWhiteSpace(@event.Deadline)) { _deadline = new TaskDeadline(DateTime.Parse(@event.Deadline)); } }
public Task(ProjectId projectId, Title title, TaskPriority priority, TaskDeadline deadline) : base(TaskId.Create(projectId, title)) { if (title == null) { throw new ArgumentNullException("title"); } if (priority == null) { throw new ArgumentNullException("priority"); } if (deadline == null) { throw new ArgumentNullException("deadline"); } ApplyChange(new TaskRegistered(Id, projectId, title, priority.DisplayName, deadline)); }
private void Apply(DeadlineOnTaskChanged @event) { _deadline = new TaskDeadline(DateTime.Parse(@event.NewDeadline)); }