public void Assignment_IsRemoved_WhenResourceIsRemoved() { var taskId1 = TaskId.Create(); var taskId2 = TaskId.Create(); var resourceId1 = ResourceId.Create(); var resourceId2 = ResourceId.Create(); var project = Project.Create() .AddTask(taskId1) .Project .AddTask(taskId2) .AddPredecessorLink(taskId1) .Project .AddResource(resourceId1) .Project .AddResource(resourceId2) .Project .AddAssignment(taskId1, resourceId1) .Project .AddAssignment(taskId2, resourceId2) .Project .RemoveResource(resourceId1); ProjectAssert.For(project) .HasTask(taskId1) .HasTask(taskId2) .HasNoResource(resourceId1) .HasNoAssignment(taskId1, resourceId1) .HasAssignment(taskId2, resourceId2); }
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 Assignment_TaskName_ResourceName_AreUpdated() { var taskId = TaskId.Create(); var resourceId = ResourceId.Create(); var project = Project.Create() .WithStart(new DateTime(2018, 2, 5)) .AddTask(taskId) .WithName("Some Task") .Project .AddResource(resourceId) .WithName("Some Resource") .Project .AddAssignment(taskId, resourceId) .Project .GetTask(taskId) .WithName("Some New Task") .Project .GetResource(resourceId) .WithName("Some New Resource") .Project; ProjectAssert.For(project) .ForAssignment(taskId, resourceId) .AssertTaskName("Some New Task") .AssertResourceName("Some New Resource"); }
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_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 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)); }
private void AddTaskToGridView(string projectId, string title, string priority, DateTime?deadline) { var taskId = TaskId.Create(new ProjectId(projectId), title); string possibleDeadline = deadline.HasValue ? deadline.Value.ToShortDateString() : null; var newTask = new TaskInGridView(taskId, projectId, title, possibleDeadline, priority, false); AddTaskToGridView(newTask); }
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 GivenIHaveATask() { var title = Base.Fixture.Create <string>(); var projectId = Base.Fixture.Create <ProjectId>(); var registerTask = new Domain.Features.RegisterTask.RegisterTask(projectId, title, TaskPriority.Low.DisplayName, Base.Fixture.Create <DateTime>()); Base.CommandDispatcher.Send(registerTask); ScenarioContext.Current.ProjectId(new ProjectId(projectId)); ScenarioContext.Current.TaskId(TaskId.Create(projectId, title)); }
static void GenerateAcmePlan() { var planId = PlanId.Create(); var newPLan = new CreateCollaborativePlan(planId, "ACME plan", "Description goes here...", "BigBoss(guest)"); Wiring.Proxy.SendCommand(newPLan); foreach (string task in "Write executive summary,Tax planning".Split(',')) { Console.WriteLine(task); var taskId = TaskId.Create(); Wiring.Proxy.SendCommand(new CreateTask(planId, taskId, task, Reccurence.Daily)); Wiring.Proxy.SendCommand(new AssociateTaskToPlan(planId, taskId)); Thread.Sleep(200); } }
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)); }
private static void GenerateSignePlan() { var planId = PlanId.Create(); var newPLan = new CreateCollaborativePlan(planId, "Signes behov", "Description goes here...", Thread.CurrentPrincipal.Identity.Name); Wiring.Proxy.SendCommand(newPLan); Wiring.Proxy.SendCommand(new AddCollaborator(planId, "jonas(guest)", "Admin")); Wiring.Proxy.SendCommand(new AddCollaborator(planId, "jenny(guest)", "Collaborator")); foreach (var task in "D-droppar,Kåvepenin - morgon,Kåvepenin - eftermiddag,Kåvepenin - kväll,Borsta tänderna - morgon,Borsta tänderna - kväll,Kolla naglar".Split(',')) { Console.WriteLine(task); var taskId = TaskId.Create(); Wiring.Proxy.SendCommand(new CreateTask(planId, taskId, task, Reccurence.Daily)); Wiring.Proxy.SendCommand(new AssociateTaskToPlan(planId, taskId)); Thread.Sleep(200); } }
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)); }
static void GenerateDesmondPlan() { var days = CultureInfo.CurrentCulture.DateTimeFormat.DayNames; var planId = PlanId.Create(); var newPLan = new CreateCollaborativePlan(planId, "Desmonds åtaganden", "Saker som Desmond ska göra för att få veckopeng", Thread.CurrentPrincipal.Identity.Name); Wiring.Proxy.SendCommand(newPLan); Wiring.Proxy.SendCommand(new AddCollaborator(planId, "jonas(guest)", "Admin")); Wiring.Proxy.SendCommand(new AddCollaborator(planId, "jenny(guest)", "Collaborator")); Wiring.Proxy.SendCommand(new AddCollaborator(planId, "desmond(guest)", "Auditor")); foreach (var taskTitle in "Städa rummet (Varje vecka),Gå igenom läsläxa(Varje vecka på Onsdag),Packa gympakläder(Varje vecka på Torsdag),Kolla naglar(Varje vecka på Söndag)".Split(',')) { Console.WriteLine(taskTitle); var reccurence = (taskTitle.Contains("Varje vecka")) ? Reccurence.Weekly : Reccurence.Daily; var taskId = TaskId.Create(); var taskCommand = new CreateTask(planId, taskId, taskTitle, reccurence); Wiring.Proxy.SendCommand(taskCommand); Wiring.Proxy.SendCommand(new AssociateTaskToPlan(planId, taskId)); Thread.Sleep(200); // Power nap to allow cool down... var complete = new MarkTaskCompleted(taskId, "jonas(guest)", DateTimeOffset.Now); Wiring.Proxy.SendCommand(complete); Thread.Sleep(200); // Power nap to allow cool down... // Check for day names in the culture, // Check if we can generate and reccurence policy, ie "Every week on Tuesdays" => "Every [interval] on [dayName]" } }
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)); }
private static Project CreateProject() { var time = TimeConversion.Default; var designTaskId = TaskId.Create(); var implementationTaskId = TaskId.Create(); var migrationTaskId = TaskId.Create(); var finishTaskId = TaskId.Create(); var immoResourceId = ResourceId.Create(); var thomasResourceId = ResourceId.Create(); return(Project.Create() .WithName("Some Software Project") .WithStart(new DateTimeOffset(2018, 1, 29, 0, 0, 0, DateTimeOffset.Now.Offset)) .AddTask(designTaskId) .WithName("Design") .WithDuration(time.FromDays(5)).Project .AddTask(implementationTaskId) .WithName("Implementation") .WithDuration(time.FromDays(10)) .AddPredecessorLink(designTaskId).Project .AddTask(migrationTaskId) .WithName("Migration") .WithDuration(time.FromDays(8)).Project .AddTask(finishTaskId) .WithName("Finish") .AddPredecessorLink(implementationTaskId) .AddPredecessorLink(migrationTaskId).Project .AddResource(immoResourceId) .WithName("Immo").Project .AddResource(thomasResourceId) .WithName("Thomas").Project .AddAssignment(designTaskId, immoResourceId).Project .AddAssignment(implementationTaskId, immoResourceId).Project .AddAssignment(implementationTaskId, thomasResourceId).Project .AddAssignment(migrationTaskId, thomasResourceId).Project); }