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


C# ProjectManager.IsGroup方法代码示例

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


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

示例1: GroupIntoParent

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

            // setup: group1 contains one
            manager.Group(group1, one);

            // test: grouping into parent (no effect, since already grouped)
            manager.Group(one, group1);
            Assert.IsTrue(manager.IsGroup(group1));
            Assert.IsTrue(!manager.IsGroup(one));
            Assert.IsTrue(manager.ParentOf(one).Equals(group1));
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:17,代码来源:ProjectTest.cs

示例2: GroupIntoSelf

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

            var group1 = new Task();

            // test: group into self (no effect)
            manager.Group(group1, group1);
            Assert.IsTrue(!manager.IsGroup(group1));
            Assert.IsTrue(manager.ParentOf(group1) == null);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:11,代码来源:ProjectTest.cs

示例3: GroupIntoAnotherGroupWhenAlreadyHaveGroup

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

            // setup: group1 contains one
            manager.Group(group1, one);

            // test: group one into group2, leaving group1
            manager.Group(group2, one);
            Assert.IsTrue(!manager.IsGroup(group1), string.Format("{0} != {1}", true, manager.IsGroup(group1)));
            Assert.IsTrue(manager.IsGroup(group2));
            Assert.IsTrue(!manager.IsGroup(one));
            Assert.IsTrue(manager.ParentOf(one).Equals(group2));
            Assert.IsTrue(manager.ChildrenOf(group1).Count() == 0);
            Assert.IsTrue(manager.ChildrenOf(group2).Count() == 1);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:22,代码来源:ProjectTest.cs

示例4: GroupIntoGrandParent

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

            // setup: group1 contain group2 contain one
            manager.Group(group1, group2);
            manager.Group(group2, one);

            // test: group into grandparent (allowed)
            manager.Group(group1, one);
            Assert.IsTrue(manager.IsGroup(group1));
            Assert.IsTrue(!manager.IsGroup(group2));
            Assert.IsTrue(!manager.IsGroup(one));
            Assert.IsTrue(manager.ParentOf(one).Equals(group1));
            Assert.IsTrue(manager.ParentOf(group2).Equals(group1));
            Assert.IsTrue(manager.ParentOf(group1) == null);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:23,代码来源:ProjectTest.cs

示例5: GroupCannotBeRelated

        public void GroupCannotBeRelated()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            var group = new Task();
            var member = new Task();
            var one = new Task();
            manager.Add(group);
            manager.Add(member);
            manager.Add(one);

            // setup: make a group
            manager.Group(group, member);
            Assert.IsTrue(manager.IsGroup(group));
            Assert.IsTrue(manager.IsMember(member));
            Assert.IsTrue(!manager.HasRelations(one));

            // test: relate a task and a group (not allowed)
            manager.Relate(group, one);
            Assert.IsTrue(manager.IsGroup(group));
            Assert.IsTrue(manager.IsMember(member));
            Assert.IsTrue(!manager.HasRelations(group));
            Assert.IsTrue(!manager.HasRelations(one));

            // test: relate a task and a group, now in another order (not allowed)
            manager.Relate(one, group);
            Assert.IsTrue(manager.IsGroup(group));
            Assert.IsTrue(manager.IsMember(member));
            Assert.IsTrue(!manager.HasRelations(group));
            Assert.IsTrue(!manager.HasRelations(one));
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:30,代码来源:ProjectTest.cs

示例6: GroupChildIntoSelf

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

            // setup: group1 contain group2 contain one
            manager.Group(group1, one);

            // test: group into self (no effect)
            manager.Group(one, one);
            Assert.IsTrue(!manager.IsGroup(one));
            Assert.IsTrue(manager.ParentOf(one) == group1);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:16,代码来源:ProjectTest.cs

示例7: UngroupPartShouldUngroupSplitTask

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

            // setup: create a group and split under it
            manager.Split(split, part1, part2, 1);
            manager.Group(group, part1); // intentionall group using part
            Assert.IsTrue(manager.IsGroup(group));
            Assert.IsTrue(manager.IsMember(split));
            Assert.IsTrue(!manager.IsMember(part1));
            Assert.IsTrue(!manager.IsMember(part2));

            // test: ungroup part should ungroup split task
            manager.Ungroup(group, part2);
            Assert.IsTrue(!manager.IsGroup(group));
            Assert.IsTrue(!manager.IsMember(split));
            Assert.IsTrue(!manager.IsMember(part1));
            Assert.IsTrue(!manager.IsMember(part2));
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:25,代码来源:ProjectTest.cs

示例8: SetPartCompleteUpdatesSplitTaskAndGroup

        public void SetPartCompleteUpdatesSplitTaskAndGroup()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            var split = new Task() { Name = "split" };
            var part1 = new Task() { Name = "part1" };
            var part2 = new Task() { Name = "part2" };
            var group = new Task() { Name = "group" };
            var member = new Task() { Name = "member" };
            manager.Add(split);
            manager.Add(member);
            manager.Add(group);

            // setup: create split task under a group
            manager.SetDuration(split, 6);
            manager.SetDuration(member, 14);
            manager.Group(group, split);
            manager.Group(group, member);
            manager.Split(split, part1, part2, 2);
            Assert.IsTrue(manager.IsGroup(group));
            Assert.IsTrue(manager.IsMember(member));
            Assert.IsTrue(manager.IsMember(split));

            Assert.IsTrue(group.Complete == 0);
            Assert.IsTrue(split.Complete == 0);
            Assert.IsTrue(part1.Complete == 0);
            Assert.IsTrue(part2.Complete == 0);

            Assert.IsTrue(group.Duration == 14);
            Assert.IsTrue(member.Duration == 14);
            Assert.IsTrue(split.Duration == 7);
            Assert.IsTrue(part1.Duration == 2);
            Assert.IsTrue(part2.Duration == 4);

            // test: set complete for part1 and see group and split complete increase
            manager.SetComplete(part1, 0.3f);
            Assert.IsTrue(Math.Abs(split.Complete - (0.3f * 2) / 6.0f) < 0.01f);
            Assert.IsTrue(Math.Abs(group.Complete - (split.Complete * 7) / 20.0f) < 0.01f);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:38,代码来源:TaskTest.cs

示例9: UngroupNullTaskFromGroup

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

            // setup: make an actual group first
            manager.Group(group1, one);
            Assert.IsTrue(manager.IsGroup(group1));
            Assert.IsTrue(manager.Tasks.Count() == 2);
            Assert.IsTrue(manager.Tasks.Contains(one));
            Assert.IsTrue(manager.Tasks.Contains(group1));

            // test: ungroup null (no effect)
            manager.Ungroup(group1, null);
            Assert.IsTrue(manager.IsGroup(group1));
            Assert.IsTrue(manager.Tasks.Count() == 2);
            Assert.IsTrue(manager.Tasks.Contains(one));
            Assert.IsTrue(manager.Tasks.Contains(group1));
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:22,代码来源:ProjectTest.cs

示例10: UngroupPartBecomeUngroupSplitTask

        public void UngroupPartBecomeUngroupSplitTask()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            var split = new Task() { Name = "split" };
            var part1 = new Task() { Name = "part1" };
            var part2 = new Task() { Name = "part2" };
            var group = new Task() { Name = "group" };
            var task = new Task() { Name = "task" };
            manager.Add(split);
            manager.Add(group);
            manager.Add(task);

            // setup: group split task into group
            manager.Split(split, part1, part2, 2);
            manager.Group(group, task);
            manager.Group(group, split);
            Assert.IsTrue(manager.IsSplit(split));
            Assert.IsTrue(manager.IsPart(part1));
            Assert.IsTrue(manager.IsPart(part2));
            Assert.IsTrue(manager.IsGroup(group));
            Assert.IsTrue(manager.IsMember(task));
            Assert.IsTrue(!manager.IsMember(part1));
            Assert.IsTrue(manager.IsMember(split));
            Assert.IsTrue(manager.ChildrenOf(group).Count() == 2);
            Assert.IsTrue(manager.ChildrenOf(group).Contains(task));
            Assert.IsTrue(manager.ChildrenOf(group).Contains(split));

            // test: ungroup part from group
            manager.Ungroup(group, part1);
            Assert.IsTrue(manager.IsSplit(split));
            Assert.IsTrue(manager.IsPart(part1));
            Assert.IsTrue(manager.IsPart(part2));
            Assert.IsTrue(manager.IsGroup(group));
            Assert.IsTrue(manager.IsMember(task));
            Assert.IsTrue(!manager.IsMember(part1));
            Assert.IsTrue(!manager.IsMember(split));
            Assert.IsTrue(manager.ChildrenOf(group).Count() == 1);
            Assert.IsTrue(manager.ChildrenOf(group).Contains(task));
            Assert.IsTrue(!manager.ChildrenOf(group).Contains(split));
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:40,代码来源:ProjectTest.cs

示例11: UngroupNonGroup

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

            // test: ungroup a task that wasn't a group in the first place (no effect)
            manager.Ungroup(group1);
            Assert.IsTrue(!manager.IsGroup(group1));
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:10,代码来源:ProjectTest.cs

示例12: UngroupAGroup

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

            // setup: group1 contains group2; group2 contains one and two
            manager.Group(group1, group2);
            manager.Group(group2, one);
            manager.Group(group2, two);

            // test: group2 is no longer a group; one and two goes into group 1 (parent of group 2)
            manager.Ungroup(group1);
            Assert.IsTrue(!manager.IsGroup(group1));
            Assert.IsTrue(manager.IsGroup(group2));
            Assert.IsTrue(!manager.IsGroup(one));
            Assert.IsTrue(!manager.IsGroup(two));
            Assert.IsTrue(manager.ChildrenOf(group1).Count() == 0);
            Assert.IsTrue(manager.ChildrenOf(group2).Count() == 2);
            Assert.IsTrue(manager.Tasks.Count() == 4);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:27,代码来源:ProjectTest.cs

示例13: HasRelationTaskCannotBecomeGroup

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

            // setup: create a relation
            manager.Relate(one, two);
            Assert.IsTrue(manager.HasRelations(one));
            Assert.IsTrue(manager.HasRelations(two));

            // test: make a group with another task (not allowed)
            manager.Group(one, member);
            Assert.IsTrue(manager.HasRelations(one));
            Assert.IsTrue(manager.HasRelations(two));
            Assert.IsTrue(!manager.IsGroup(one));
            Assert.IsTrue(!manager.IsMember(member));

            // test: make a group with another task (not allowed)
            manager.Group(two, member);
            Assert.IsTrue(manager.HasRelations(one));
            Assert.IsTrue(manager.HasRelations(two));
            Assert.IsTrue(!manager.IsGroup(two));
            Assert.IsTrue(!manager.IsMember(member));
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:29,代码来源:ProjectTest.cs

示例14: GroupKnownTasksAndGroups

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

            var one = new Task();
            var two = new Task();
            var three = new Task();
            var four = new Task();
            var five = new Task();
            var six = new Task();

            manager.Add(one);
            manager.Add(two);
            manager.Add(three);
            manager.Add(four);
            manager.Add(five);
            manager.Add(six);

            // test: groupings
            manager.Group(one, two);
            manager.Group(two, three);
            manager.Group(two, six);
            manager.Group(four, five);
            Assert.IsTrue(manager.IsGroup(one));
            Assert.IsTrue(manager.IsGroup(two));
            Assert.IsTrue(!manager.IsGroup(three));
            Assert.IsTrue(manager.IsGroup(four));
            Assert.IsTrue(!manager.IsGroup(five));
            Assert.IsTrue(!manager.IsGroup(six));

            // test: check task
            Assert.IsTrue(manager.Tasks.Contains(one));
            Assert.IsTrue(manager.Tasks.Contains(two));
            Assert.IsTrue(manager.Tasks.Contains(three));
            Assert.IsTrue(manager.Tasks.Contains(four));
            Assert.IsTrue(manager.Tasks.Contains(five));
            Assert.IsTrue(manager.Tasks.Contains(six));

            // test: check decendants
            Assert.IsTrue(manager.DecendantsOf(four).Contains(five));
            Assert.IsTrue(manager.DecendantsOf(one).Contains(two));
            Assert.IsTrue(manager.DecendantsOf(one).Contains(three));
            Assert.IsTrue(manager.DecendantsOf(one).Contains(six));
            Assert.IsTrue(manager.DecendantsOf(one).Count() == 3);

            // test: check ancestors
            Assert.IsTrue(manager.AncestorsOf(six).Contains(two));
            Assert.IsTrue(manager.AncestorsOf(six).Contains(one));
            Assert.IsTrue(manager.AncestorsOf(six).Count() == 2);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:50,代码来源:ProjectTest.cs

示例15: UngroupUnknownGroup

        public void UngroupUnknownGroup()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            IProjectManager<Task, object> other = new ProjectManager<Task, object>();
            var group = new Task();
            var one = new Task();
            other.Add(group);
            other.Add(one);

            // setup: make a foreign group
            other.Group(group, one);
            Assert.IsTrue(other.IsGroup(group));
            Assert.IsTrue(manager.Tasks.Count() == 0);

            // test: check whether can ungroup unknown group
            manager.Ungroup(group);
            Assert.IsTrue(other.IsGroup(group));
            Assert.IsTrue(manager.Tasks.Count() == 0);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:19,代码来源:ProjectTest.cs


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