当前位置: 首页>>代码示例>>C#>>正文


C# ProjectManager.Delete方法代码示例

本文整理汇总了C#中ProjectManager.Delete方法的典型用法代码示例。如果您正苦于以下问题:C# ProjectManager.Delete方法的具体用法?C# ProjectManager.Delete怎么用?C# ProjectManager.Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ProjectManager的用法示例。


在下文中一共展示了ProjectManager.Delete方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DeleteMiddlePart

        public void DeleteMiddlePart()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            var split = new Task();
            var part1 = new Task();
            var part2 = new Task();
            var part3 = new Task();
            manager.Add(split);

            // setup: create a 3 part split task
            manager.SetDuration(split, 30);
            manager.Split(split, part1, part2, 4);
            manager.Split(part2, part3, 5);
            Assert.IsTrue(manager.IsSplit(split));
            Assert.IsTrue(manager.IsPart(part1));
            Assert.IsTrue(manager.IsPart(part2));
            Assert.IsTrue(manager.IsPart(part3));
            Assert.IsTrue(part1.Start == 0);
            Assert.IsTrue(part2.Start == 5);
            Assert.IsTrue(part3.Start == 11);
            Assert.IsTrue(part1.Duration == 4);
            Assert.IsTrue(part2.Duration == 5);
            Assert.IsTrue(part3.Duration == 21);
            Assert.IsTrue(split.Start == 0);
            Assert.IsTrue(split.End == 32);

            // test: delete part2, part1 and part3 should not be affected
            manager.Delete(part2);
            Assert.IsTrue(manager.IsSplit(split));
            Assert.IsTrue(manager.IsPart(part1));
            Assert.IsTrue(!manager.IsPart(part2));
            Assert.IsTrue(manager.IsPart(part3));
            Assert.IsTrue(part1.Duration == 4);
            Assert.IsTrue(part3.Duration == 21);
            Assert.IsTrue(part1.Start == 0);
            Assert.IsTrue(part3.Start == 11);
            Assert.IsTrue(part3.End == 32);
            Assert.IsTrue(split.Start == 0);
            Assert.IsTrue(split.End == 32);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:40,代码来源:ProjectTest.cs

示例2: CreateAndRemoveGroup

        public void CreateAndRemoveGroup()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            var group1 = new Task();
            var one = new Task();
            var two = new Task();
            manager.Add(group1);
            manager.Add(one);
            manager.Add(two);

            // make group
            manager.Group(group1, one);
            manager.Group(group1, two);
            Assert.IsTrue(manager.Tasks.Count() == 3);
            Assert.IsTrue(manager.ChildrenOf(group1).Count() == 2);
            Assert.IsTrue(manager.ParentOf(one).Equals(group1));
            Assert.IsTrue(manager.ParentOf(two).Equals(group1));

            // delete group task
            manager.Delete(group1);
            Assert.IsTrue(manager.Tasks.Count() == 2);
            Assert.IsTrue(manager.ChildrenOf(group1).Count() == 0);
            Assert.IsTrue(manager.ParentOf(one) == null);
            Assert.IsTrue(manager.ParentOf(two) == null);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:25,代码来源:ProjectTest.cs

示例3: CreateAndRemoveTask

        public void CreateAndRemoveTask()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();

            // create first task
            var first = new Task();
            manager.Add(first);
            Assert.IsTrue(manager.Tasks.Count() == 1, string.Format("{0} != {1}", 1, manager.Tasks.Count()));
            Assert.IsTrue(manager.ParentOf(first) == null);

            // create second task, remove first task
            var second = new Task();
            second.Name = "Apple Jack";
            manager.Add(second);
            manager.Delete(first);
            var firstordefault = manager.Tasks.FirstOrDefault();
            Assert.IsTrue(firstordefault != null);
            Assert.IsTrue(firstordefault.Name == "Apple Jack");
            Assert.IsTrue(firstordefault.Equals(second));

            // remove a task that is already removed
            manager.Delete(first);
            Assert.IsTrue(manager.Tasks.Count() == 1);

            // remove a null task
            manager.Delete(null);
            Assert.IsTrue(manager.Tasks.Count() == 1);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:28,代码来源:ProjectTest.cs

示例4: DeleteResourcesOnDeleteSplitTask

        public void DeleteResourcesOnDeleteSplitTask()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            var split = new Task();
            var part1 = new Task();
            var part2 = new Task();
            var r1 = new Task();
            manager.Add(split);

            // setup: create a split task with resources on parts
            manager.Split(split, part1, part2, 1);
            manager.Assign(part1, r1);
            manager.Assign(part2, r1);
            Assert.IsTrue(!manager.TasksOf(r1).Contains(split));
            Assert.IsTrue(manager.TasksOf(r1).Contains(part1));
            Assert.IsTrue(manager.TasksOf(r1).Contains(part2));
            Assert.IsTrue(!manager.ResourcesOf(split).Contains(r1));
            Assert.IsTrue(manager.ResourcesOf(part1).Contains(r1));
            Assert.IsTrue(manager.ResourcesOf(part2).Contains(r1));
            Assert.IsTrue(manager.Resources.Count() == 1);
            Assert.IsTrue(manager.Tasks.Count() == 1);

            // test: delete the split task, everything should go
            manager.Delete(split);
            Assert.IsTrue(manager.Resources.Count() == 0);
            Assert.IsTrue(manager.Tasks.Count() == 0);
            Assert.IsTrue(!manager.TasksOf(r1).Contains(split));
            Assert.IsTrue(!manager.TasksOf(r1).Contains(part1));
            Assert.IsTrue(!manager.TasksOf(r1).Contains(part2));
            Assert.IsTrue(!manager.ResourcesOf(split).Contains(r1));
            Assert.IsTrue(!manager.ResourcesOf(part1).Contains(r1));
            Assert.IsTrue(!manager.ResourcesOf(part2).Contains(r1));

            // test: check that they are really deleted by adding them back again
            manager.Add(split);
            manager.Add(part1);
            manager.Add(part2);
            Assert.IsTrue(manager.Tasks.Count() == 3);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:39,代码来源:TaskTest.cs

示例5: DeleteResourceOnDeleteTask

        public void DeleteResourceOnDeleteTask()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            var task1 = new Task();
            var task2 = new Task();
            var r1 = new Task();
            manager.Add(task1);
            manager.Add(task2);

            // setup: assign resource
            manager.Assign(task1, r1);
            manager.Assign(task2, r1);
            Assert.IsTrue(manager.ResourcesOf(task1).Contains(r1));
            Assert.IsTrue(manager.ResourcesOf(task2).Contains(r1));
            Assert.IsTrue(manager.TasksOf(r1).Count() == 2);

            // test: delete task1
            manager.Delete(task1);
            Assert.IsTrue(!manager.ResourcesOf(task1).Contains(r1));
            Assert.IsTrue(manager.ResourcesOf(task2).Contains(r1));
            Assert.IsTrue(manager.TasksOf(r1).Count() == 1);
            Assert.IsTrue(manager.Resources.Count() == 1);
            Assert.IsTrue(manager.Resources.Contains(r1));

            // test: delete task2
            manager.Delete(task2);
            Assert.IsTrue(!manager.ResourcesOf(task1).Contains(r1));
            Assert.IsTrue(!manager.ResourcesOf(task2).Contains(r1));
            Assert.IsTrue(manager.TasksOf(r1).Count() == 0);
            Assert.IsTrue(manager.Resources.Count() == 0);
            Assert.IsTrue(!manager.Resources.Contains(r1));
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:32,代码来源:TaskTest.cs

示例6: DeletePartsOnDeleteSplitTask

        public void DeletePartsOnDeleteSplitTask()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            var split = new Task();
            var part1 = new Task();
            var part2 = new Task();
            manager.Add(split);

            // setup: create a split task with resources on parts
            manager.Split(split, part1, part2, 1);
            Assert.IsTrue(manager.IsSplit(split));
            Assert.IsTrue(manager.IsPart(part1));
            Assert.IsTrue(manager.IsPart(part2));
            Assert.IsTrue(manager.Tasks.Count() == 1);

            // test: ensure that we cannot add the tasks parts and split again
            manager.Add(split);
            manager.Add(part1);
            manager.Add(part2);
            Assert.IsTrue(manager.Tasks.Count() == 1);

            // test: delete a part, expect a merge to regular task
            manager.Delete(split);
            Assert.IsTrue(!manager.IsSplit(split));
            Assert.IsTrue(!manager.IsPart(part1));
            Assert.IsTrue(!manager.IsPart(part2));
            Assert.IsTrue(manager.Tasks.Count() == 0);

            // test: if really deleted, we should be able to add them back
            manager.Add(split);
            Assert.IsTrue(manager.Tasks.Count() == 1);

            // test: now we should be able to add again
            manager.Add(split);
            manager.Add(part1);
            manager.Add(part2);
            Assert.IsTrue(manager.Tasks.Count() == 3);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:38,代码来源:TaskTest.cs

示例7: DeletePartCausingMerge

        public void DeletePartCausingMerge()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            var split = new Task();
            var part1 = new Task();
            var part2 = new Task();
            manager.Add(split);

            // setup: create a split task with resources on parts
            manager.Split(split, part1, part2, 1);
            Assert.IsTrue(manager.IsSplit(split));
            Assert.IsTrue(manager.IsPart(part1));
            Assert.IsTrue(manager.IsPart(part2));

            // test: delete a part, expect a merge to regular task
            manager.Delete(part1);
            Assert.IsTrue(!manager.IsSplit(split));
            Assert.IsTrue(!manager.IsPart(part1));
            Assert.IsTrue(!manager.IsPart(part2));
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:20,代码来源:TaskTest.cs

示例8: TransferResourceToSplitTaskOnMerge_ByDeleteInThisCase

        public void TransferResourceToSplitTaskOnMerge_ByDeleteInThisCase()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            var split = new Task();
            var part1 = new Task();
            var part2 = new Task();
            var r1 = new Task();
            manager.Add(split);

            // setup: create a split task with resources on parts
            manager.Split(split, part1, part2, 1);
            manager.Assign(part1, r1);
            manager.Assign(part2, r1);
            Assert.IsTrue(!manager.TasksOf(r1).Contains(split));
            Assert.IsTrue(manager.TasksOf(r1).Contains(part1));
            Assert.IsTrue(manager.TasksOf(r1).Contains(part2));
            Assert.IsTrue(!manager.ResourcesOf(split).Contains(r1));
            Assert.IsTrue(manager.ResourcesOf(part1).Contains(r1));
            Assert.IsTrue(manager.ResourcesOf(part2).Contains(r1));
            Assert.IsTrue(manager.Resources.Count() == 1);

            // test: delete a part, expect a merge and resources transferred to split task
            manager.Delete(part1);
            Assert.IsTrue(manager.TasksOf(r1).Contains(split));
            Assert.IsTrue(!manager.TasksOf(r1).Contains(part1));
            Assert.IsTrue(!manager.TasksOf(r1).Contains(part2));
            Assert.IsTrue(manager.ResourcesOf(split).Contains(r1));
            Assert.IsTrue(!manager.ResourcesOf(part1).Contains(r1));
            Assert.IsTrue(!manager.ResourcesOf(part2).Contains(r1));
            Assert.IsTrue(manager.Resources.Count() == 1);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:31,代码来源:TaskTest.cs


注:本文中的ProjectManager.Delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。