public void Assignment_Units() { var taskId = TaskId.Create(); var resourceId1 = ResourceId.Create(); var resourceId2 = ResourceId.Create(); var project = Project.Create() .WithStart(new DateTime(2018, 2, 5)) .AddTask(taskId).Project .AddResource(resourceId1).Project .AddResource(resourceId2).Project .AddAssignment(taskId, resourceId1) .WithWork(ProjectTime.FromHours(40)) .WithUnits(.5).Project .AddAssignment(taskId, resourceId2) .WithWork(ProjectTime.FromHours(20)).Project; ProjectAssert.For(project) .ForTask(0) .AssertDuration(ProjectTime.FromDays(10)) .AssertWork(ProjectTime.FromHours(60)) .AssertStart(new DateTime(2018, 2, 5, 8, 0, 0)) .AssertFinish(new DateTime(2018, 2, 16, 17, 0, 0)) .Project .ForAssignment(taskId, resourceId1) .AssertWork(ProjectTime.FromHours(40)) .AssertStart(new DateTime(2018, 2, 5, 8, 0, 0)) .AssertFinish(new DateTime(2018, 2, 16, 17, 0, 0)) .Project .ForAssignment(taskId, resourceId2) .AssertWork(ProjectTime.FromHours(20)) .AssertStart(new DateTime(2018, 2, 5, 8, 0, 0)) .AssertFinish(new DateTime(2018, 2, 7, 12, 0, 0)); }
public void Calendar_NightShift() { var taskId1 = TaskId.Create(); var taskId2 = TaskId.Create(); var project = Project.Create() .WithStart(new DateTime(2018, 2, 1)) .WithCalendar(Calendar.NightShift) .AddTask(taskId1) .WithDuration(ProjectTime.FromDays(10)).Project .AddTask(taskId2) .WithDuration(ProjectTime.FromDays(5)) .AddPredecessorLink(taskId1).Project; ProjectAssert.For(project) .ForTask(0) .AssertDuration(ProjectTime.FromDays(10)) .AssertStart(new DateTime(2018, 2, 1, 0, 0, 0)) .AssertFinish(new DateTime(2018, 2, 15, 0, 0, 0)) .AssertWork(ProjectTime.FromDays(0)).Project .ForTask(1) .AssertDuration(ProjectTime.FromDays(5)) .AssertStart(new DateTime(2018, 2, 15, 0, 0, 0)) .AssertFinish(new DateTime(2018, 2, 22, 0, 0, 0)) .AssertWork(ProjectTime.FromDays(0)); }
public void Calendar_SixDayWorkWeek() { var taskId1 = TaskId.Create(); var taskId2 = TaskId.Create(); var workingSaturday = WorkingDay.CreateEightToFive(DayOfWeek.Saturday); var sixDayWorkWeek = WorkingWeek.Default.WithDay(workingSaturday); var calendar = Calendar.Default.WithWorkingWeek(sixDayWorkWeek); var project = Project.Create() .WithStart(new DateTime(2018, 1, 29)) .WithCalendar(calendar) .AddTask(taskId1) .WithDuration(ProjectTime.FromDays(10)).Project .AddTask(taskId2) .WithDuration(ProjectTime.FromDays(5)) .AddPredecessorLink(taskId1).Project; ProjectAssert.For(project) .ForTask(0) .AssertDuration(ProjectTime.FromDays(10)) .AssertStart(new DateTime(2018, 1, 29, 8, 0, 0)) .AssertFinish(new DateTime(2018, 2, 8, 17, 0, 0)) .AssertWork(TimeSpan.Zero).Project .ForTask(1) .AssertDuration(ProjectTime.FromDays(5)) .AssertStart(new DateTime(2018, 2, 9, 8, 0, 0)) .AssertFinish(new DateTime(2018, 2, 14, 17, 0, 0)) .AssertWork(TimeSpan.Zero); }
public void Calendar_Default() { var taskId1 = TaskId.Create(); var taskId2 = TaskId.Create(); var project = Project.Create() .WithStart(new DateTime(2018, 1, 29)) .AddTask(taskId1) .WithDuration(ProjectTime.FromDays(10)).Project .AddTask(taskId2) .WithDuration(ProjectTime.FromDays(5)) .AddPredecessorLink(taskId1).Project; ProjectAssert.For(project) .ForTask(0) .AssertDuration(ProjectTime.FromDays(10)) .AssertStart(new DateTime(2018, 1, 29, 8, 0, 0)) .AssertFinish(new DateTime(2018, 2, 9, 17, 0, 0)) .AssertWork(TimeSpan.Zero).Project .ForTask(1) .AssertDuration(ProjectTime.FromDays(5)) .AssertStart(new DateTime(2018, 2, 12, 8, 0, 0)) .AssertFinish(new DateTime(2018, 2, 16, 17, 0, 0)) .AssertWork(TimeSpan.Zero); }
public void Calendar_TwentyFourSeven() { var taskId1 = TaskId.Create(); var taskId2 = TaskId.Create(); var project = Project.Create() .WithStart(new DateTime(2018, 2, 1)) .WithCalendar(Calendar.TwentyFourSeven) .AddTask(taskId1) .WithDuration(ProjectTime.FromDays(10)).Project .AddTask(taskId2) .WithDuration(ProjectTime.FromDays(5)) .AddPredecessorLink(taskId1).Project; ProjectAssert.For(project) .ForTask(0) .AssertDuration(ProjectTime.FromDays(10)) .AssertStart(new DateTime(2018, 2, 1, 0, 0, 0)) .AssertFinish(new DateTime(2018, 2, 4, 8, 0, 0)) .AssertWork(TimeSpan.Zero).Project .ForTask(1) .AssertDuration(ProjectTime.FromDays(5)) .AssertStart(new DateTime(2018, 2, 4, 8, 0, 0)) .AssertFinish(new DateTime(2018, 2, 6, 0, 0, 0)) .AssertWork(TimeSpan.Zero); }
public void TaskLink_FinishToFinish_NegativeSlack_BeforeProjectStart() { var taskId = TaskId.Create(); var project = Project.Create() .WithStart(new DateTime(2018, 2, 26, 8, 0, 0)) .AddTask() .WithDuration(ProjectTime.FromDays(5)).Project .AddTask(taskId) .WithDuration(ProjectTime.FromDays(3)).Project .AddTask() .WithDuration(ProjectTime.FromDays(2)) .AddPredecessorLink(taskId, TaskLinkType.FinishToFinish, ProjectTime.FromDays(-2)) .Project; ProjectAssert.For(project) .ForTask(0) .AssertPredecessors(null) .AssertStart(new DateTime(2018, 2, 26, 8, 0, 0)) .AssertFinish(new DateTime(2018, 3, 2, 17, 0, 0)) .AssertEarlyStart(new DateTime(2018, 2, 26, 8, 0, 0)) .AssertEarlyFinish(new DateTime(2018, 3, 2, 17, 0, 0)) .AssertLateStart(new DateTime(2018, 2, 26, 8, 0, 0)) .AssertLateFinish(new DateTime(2018, 3, 2, 17, 0, 0)) .AssertStartSlack(ProjectTime.FromDays(0)) .AssertFinishSlack(ProjectTime.FromDays(0)) .AssertTotalSlack(ProjectTime.FromDays(0)) .AssertFreeSlack(ProjectTime.FromDays(0)).Project .ForTask(1) .AssertPredecessors(null) .AssertStart(new DateTime(2018, 2, 26, 8, 0, 0)) .AssertFinish(new DateTime(2018, 2, 28, 17, 0, 0)) .AssertEarlyStart(new DateTime(2018, 2, 26, 8, 0, 0)) .AssertEarlyFinish(new DateTime(2018, 2, 28, 17, 0, 0)) .AssertLateStart(new DateTime(2018, 2, 28, 8, 0, 0)) .AssertLateFinish(new DateTime(2018, 3, 2, 17, 0, 0)) .AssertStartSlack(ProjectTime.FromDays(2)) .AssertFinishSlack(ProjectTime.FromDays(2)) .AssertTotalSlack(ProjectTime.FromDays(2)) .AssertFreeSlack(ProjectTime.FromDays(1)).Project .ForTask(2) .AssertPredecessors("1FF-2 days") .AssertStart(new DateTime(2018, 2, 26, 8, 0, 0)) .AssertFinish(new DateTime(2018, 2, 27, 17, 0, 0)) .AssertEarlyStart(new DateTime(2018, 2, 26, 8, 0, 0)) .AssertEarlyFinish(new DateTime(2018, 2, 27, 17, 0, 0)) .AssertLateStart(new DateTime(2018, 3, 1, 8, 0, 0)) .AssertLateFinish(new DateTime(2018, 3, 2, 17, 0, 0)) .AssertStartSlack(ProjectTime.FromDays(3)) .AssertFinishSlack(ProjectTime.FromDays(3)) .AssertTotalSlack(ProjectTime.FromDays(3)) .AssertFreeSlack(ProjectTime.FromDays(3)); }
public void Project_FinishDate() { var taskId = TaskId.Create(); var project = Project.Create() .WithStart(new DateTime(2018, 2, 5)) .AddTask(taskId) .WithDuration(ProjectTime.FromDays(2)) .Project .AddTask() .AddPredecessorLink(taskId) .WithDuration(ProjectTime.FromDays(3)) .Project; ProjectAssert.For(project) .AssertFinish(new DateTime(2018, 2, 9, 17, 0, 0)); }
public void TaskLink_StartToFinish_PositiveSlack() { var taskId = TaskId.Create(); var project = Project.Create() .WithStart(new DateTime(2018, 2, 26, 8, 0, 0)) .AddTask(taskId) .WithDuration(ProjectTime.FromDays(2)).Project .AddTask() .WithDuration(ProjectTime.FromDays(3)) .AddPredecessorLink(taskId, TaskLinkType.StartToFinish, ProjectTime.FromDays(1)) .Project; ProjectAssert.For(project) .ForTask(0) .AssertPredecessors(null) .AssertStart(new DateTime(2018, 2, 26, 8, 0, 0)) .AssertFinish(new DateTime(2018, 2, 27, 17, 0, 0)) .AssertEarlyStart(new DateTime(2018, 2, 26, 8, 0, 0)) .AssertEarlyFinish(new DateTime(2018, 2, 27, 17, 0, 0)) .AssertLateStart(new DateTime(2018, 2, 26, 8, 0, 0)) .AssertLateFinish(new DateTime(2018, 2, 27, 17, 0, 0)) .AssertStartSlack(ProjectTime.FromDays(0)) .AssertFinishSlack(ProjectTime.FromDays(0)) .AssertTotalSlack(ProjectTime.FromDays(0)) .AssertFreeSlack(ProjectTime.FromDays(0)).Project .ForTask(1) .AssertPredecessors("0SF+1 day") .AssertStart(new DateTime(2018, 2, 22, 8, 0, 0)) .AssertFinish(new DateTime(2018, 2, 26, 17, 0, 0)) .AssertEarlyStart(new DateTime(2018, 2, 22, 8, 0, 0)) .AssertEarlyFinish(new DateTime(2018, 2, 26, 17, 0, 0)) .AssertLateStart(new DateTime(2018, 2, 23, 8, 0, 0)) .AssertLateFinish(new DateTime(2018, 2, 27, 17, 0, 0)) .AssertStartSlack(ProjectTime.FromDays(1)) .AssertFinishSlack(ProjectTime.FromDays(1)) .AssertTotalSlack(ProjectTime.FromDays(1)) .AssertFreeSlack(ProjectTime.FromDays(1)); }
public void Assignment_Work_InitializedFrom_Task_Duration() { var taskId = TaskId.Create(); var resourceId = ResourceId.Create(); var project = Project.Create() .WithStart(new DateTime(2018, 1, 29)) .AddTask(taskId) .WithDuration(ProjectTime.FromDays(10)).Project .AddResource(resourceId).Project .AddAssignment(taskId, resourceId).Project; ProjectAssert.For(project) .ForTask(0) .AssertDuration(ProjectTime.FromDays(10)) .AssertWork(ProjectTime.FromHours(80)) .AssertStart(new DateTime(2018, 1, 29, 8, 0, 0)) .AssertFinish(new DateTime(2018, 2, 9, 17, 0, 0)).Project .ForAssignment(taskId, resourceId) .AssertWork(ProjectTime.FromHours(80)) .AssertStart(new DateTime(2018, 1, 29, 8, 0, 0)) .AssertFinish(new DateTime(2018, 2, 9, 17, 0, 0)); }
public void TaskLink_FinishToStart_NegativeSlack() { var taskId = TaskId.Create(); var project = Project.Create() .WithStart(new DateTime(2018, 2, 26, 8, 0, 0)) .AddTask(taskId) .WithDuration(ProjectTime.FromDays(2)).Project .AddTask() .WithDuration(ProjectTime.FromDays(3)) .AddPredecessorLink(taskId, lag: ProjectTime.FromDays(-1)).Project; ProjectAssert.For(project) .ForTask(0) .AssertPredecessors(null) .AssertStart(new DateTime(2018, 2, 26, 8, 0, 0)) .AssertFinish(new DateTime(2018, 2, 27, 17, 0, 0)) .AssertEarlyStart(new DateTime(2018, 2, 26, 8, 0, 0)) .AssertEarlyFinish(new DateTime(2018, 2, 27, 17, 0, 0)) .AssertLateStart(new DateTime(2018, 2, 26, 8, 0, 0)) .AssertLateFinish(new DateTime(2018, 2, 27, 17, 0, 0)) .AssertStartSlack(ProjectTime.FromDays(0)) .AssertFinishSlack(ProjectTime.FromDays(0)) .AssertTotalSlack(ProjectTime.FromDays(0)) .AssertFreeSlack(ProjectTime.FromDays(0)).Project .ForTask(1) .AssertPredecessors("0FS-1 days") .AssertStart(new DateTime(2018, 2, 27, 8, 0, 0)) .AssertFinish(new DateTime(2018, 3, 1, 17, 0, 0)) .AssertEarlyStart(new DateTime(2018, 2, 27, 8, 0, 0)) .AssertEarlyFinish(new DateTime(2018, 3, 1, 17, 0, 0)) .AssertLateStart(new DateTime(2018, 2, 27, 8, 0, 0)) .AssertLateFinish(new DateTime(2018, 3, 1, 17, 0, 0)) .AssertStartSlack(ProjectTime.FromDays(0)) .AssertFinishSlack(ProjectTime.FromDays(0)) .AssertTotalSlack(ProjectTime.FromDays(0)) .AssertFreeSlack(ProjectTime.FromDays(0)); }