本文整理汇总了C#中ProjectManager.ChildrenOf方法的典型用法代码示例。如果您正苦于以下问题:C# ProjectManager.ChildrenOf方法的具体用法?C# ProjectManager.ChildrenOf怎么用?C# ProjectManager.ChildrenOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectManager
的用法示例。
在下文中一共展示了ProjectManager.ChildrenOf方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GroupIntoGrandChild
public void GroupIntoGrandChild()
{
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);
// group into grandchild (no effect)
manager.Group(one, group1);
Assert.IsTrue(manager.ChildrenOf(group1).Contains(group2));
Assert.IsTrue(manager.ChildrenOf(group2).Contains(one));
Assert.IsTrue(manager.ChildrenOf(one).Count() == 0);
}
示例2: GroupPartsBecomeGroupSplitTask
public void GroupPartsBecomeGroupSplitTask()
{
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: create a split task and a group
manager.Split(split, part1, part2, 2);
manager.Group(group, task);
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));
// test: group part into task;
manager.Group(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() == 2);
Assert.IsTrue(manager.ChildrenOf(group).Contains(task));
Assert.IsTrue(manager.ChildrenOf(group).Contains(split));
// test: group task into part (no effect)
manager.Group(part1, task);
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.IsGroup(part1));
Assert.IsTrue(manager.ChildrenOf(group).Count() == 2);
Assert.IsTrue(manager.ChildrenOf(group).Contains(task));
Assert.IsTrue(manager.ChildrenOf(group).Contains(split));
}
示例3: EnumerationShouldReturnEmptySet
public void EnumerationShouldReturnEmptySet()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var alien = new Task();
// test: Enumerators should at least return empty sets
Assert.IsNotNull(manager.ChildrenOf(alien), "ChildrenOf is null");
Assert.IsNotNull(manager.AncestorsOf(alien), "AncestorsOf is null");
Assert.IsNotNull(manager.DecendantsOf(alien), "DecendantsOf is null");
Assert.IsNotNull(manager.DependantsOf(alien), "DependantsOf is null");
Assert.IsNotNull(manager.PrecedentsOf(alien), "PrecedentsOf is null");
Assert.IsNotNull(manager.DirectDependantsOf(alien), "DirectDependantsOf is null");
Assert.IsNotNull(manager.DirectPrecedentsOf(alien), "DirectPrecedentsOf is null");
Assert.IsNotNull(manager.ResourcesOf(alien), "ResourcesOf is null");
Assert.IsNotNull(manager.TasksOf(alien), "TasksOf is null");
}
示例4: 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);
}
示例5: 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);
}
示例6: 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));
}
示例7: 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);
}
示例8: SubGrouping
public void SubGrouping()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
// create tasks in random order
var a = new Task();
var b = new Task();
var c1 = new Task();
var c2 = new Task();
var d1 = new Task();
var d2 = new Task();
var d3 = new Task();
var e1 = new Task();
var e2 = new Task();
var e3 = new Task();
manager.Add(b);
manager.Add(e1);
manager.Add(a);
manager.Add(e2);
manager.Add(c1);
manager.Add(d1);
manager.Add(d2);
manager.Add(e3);
manager.Add(d3);
manager.Add(c2);
// setup: make sub groups
manager.Group(a, b);
manager.Group(b, c1);
manager.Group(b, c2);
manager.Group(c1, d1);
manager.Group(c1, d2);
manager.Group(c2, d3);
manager.Group(d1, e1);
manager.Group(d2, e2);
manager.Group(d2, e3);
// test: check sub groups are correct
Assert.IsTrue(manager.ChildrenOf(a).Contains(b));
Assert.IsTrue(manager.ChildrenOf(b).Contains(c1));
Assert.IsTrue(manager.ChildrenOf(b).Contains(c2));
Assert.IsTrue(manager.ChildrenOf(c1).Contains(d1));
Assert.IsTrue(manager.ChildrenOf(c1).Contains(d2));
Assert.IsTrue(manager.ChildrenOf(c2).Contains(d3));
Assert.IsTrue(manager.ChildrenOf(d1).Contains(e1));
Assert.IsTrue(manager.ChildrenOf(d2).Contains(e2));
Assert.IsTrue(manager.ChildrenOf(d2).Contains(e3));
}
示例9: KnownTasksEnumeration
public void KnownTasksEnumeration()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var local = new Task();
manager.Add(local);
Assert.IsNotNull(manager.ChildrenOf(local));
Assert.IsNotNull(manager.AncestorsOf(local));
Assert.IsNotNull(manager.DecendantsOf(local));
Assert.IsNotNull(manager.DependantsOf(local));
Assert.IsNotNull(manager.PrecedentsOf(local));
Assert.IsNotNull(manager.DirectDependantsOf(local));
Assert.IsNotNull(manager.DirectPrecedentsOf(local));
Assert.IsNotNull(manager.ResourcesOf(local));
Assert.IsNotNull(manager.TasksOf(local));
}