示例#1
0
 /// <exception cref="DeadlineIsInThePastException">Condition.</exception>
 public void ChangeDeadline(TaskDeadline deadline)
 {
     if (deadline.InThePast)
     {
         throw new DeadlineIsInThePastException();
     }
     ApplyChange(new DeadlineOnTaskChanged(Id, deadline));
 }
示例#2
0
 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));
     }
 }
示例#3
0
 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));
 }
示例#4
0
 private void Apply(DeadlineOnTaskChanged @event)
 {
     _deadline = new TaskDeadline(DateTime.Parse(@event.NewDeadline));
 }