示例#1
0
        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));
        }
示例#2
0
        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));
        }