Exemple #1
0
        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);
        }
Exemple #2
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));
        }
Exemple #3
0
        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");
        }
Exemple #4
0
        public void Resource_Name_Set()
        {
            var resourceId = ResourceId.Create();
            var project    = Project.Create()
                             .AddResource(resourceId)
                             .WithName("Immo")
                             .Project;

            ProjectAssert.For(project)
            .ForResource(resourceId)
            .AssertName("Immo");
        }
Exemple #5
0
        public void Resource_Initials_InitializedFromName()
        {
            var resourceId = ResourceId.Create();
            var project    = Project.Create()
                             .AddResource(resourceId)
                             .WithName("Immo")
                             .Project;

            ProjectAssert.For(project)
            .ForResource(resourceId)
            .AssertInitials("I");
        }
Exemple #6
0
        public void Resource_Initials_NotModified()
        {
            var resourceId = ResourceId.Create();
            var project    = Project.Create()
                             .AddResource(resourceId)
                             .WithName("Immo")
                             .WithName("Thomas")
                             .Project;

            ProjectAssert.For(project)
            .ForResource(resourceId)
            .AssertInitials("I");
        }
Exemple #7
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));
        }
Exemple #8
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);
        }