本文整理汇总了C#中ProjectManager.HasRelations方法的典型用法代码示例。如果您正苦于以下问题:C# ProjectManager.HasRelations方法的具体用法?C# ProjectManager.HasRelations怎么用?C# ProjectManager.HasRelations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectManager
的用法示例。
在下文中一共展示了ProjectManager.HasRelations方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AllowRelateSplitTaskToTask
public void AllowRelateSplitTaskToTask()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var split = new Task();
var part1a = new Task();
var part1b = new Task();
var task = new Task();
manager.Add(split);
manager.Add(task);
// setup: create a split task
manager.Split(split, part1a, part1b, 1);
Assert.IsTrue(manager.IsSplit(split));
Assert.IsTrue(!manager.IsSplit(part1a));
Assert.IsTrue(!manager.IsSplit(part1b));
Assert.IsTrue(!manager.IsPart(split));
Assert.IsTrue(manager.IsPart(part1a));
Assert.IsTrue(manager.IsPart(part1b));
Assert.IsTrue(!manager.HasRelations(split));
Assert.IsTrue(!manager.HasRelations(part1a));
Assert.IsTrue(!manager.HasRelations(part1b));
Assert.IsTrue(!manager.HasRelations(task));
// test: relate task and split task
manager.Relate(task, split);
Assert.IsTrue(manager.IsSplit(split));
Assert.IsTrue(!manager.IsSplit(part1a));
Assert.IsTrue(!manager.IsSplit(part1b));
Assert.IsTrue(!manager.IsPart(split));
Assert.IsTrue(manager.IsPart(part1a));
Assert.IsTrue(manager.IsPart(part1b));
Assert.IsTrue(manager.HasRelations(split));
Assert.IsTrue(!manager.HasRelations(part1a));
Assert.IsTrue(!manager.HasRelations(part1b));
Assert.IsTrue(manager.HasRelations(task));
Assert.IsTrue(manager.PrecedentsOf(split).Contains(task));
}
示例2: DoNotRelatePartsOfTheSameSplitTask
public void DoNotRelatePartsOfTheSameSplitTask()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var split = new Task();
var part1a = new Task();
var part1b = new Task();
manager.Add(split);
// setup: create a split task
manager.Split(split, part1a, part1b, 1);
Assert.IsTrue(manager.IsSplit(split));
Assert.IsTrue(!manager.IsSplit(part1a));
Assert.IsTrue(!manager.IsSplit(part1b));
Assert.IsTrue(!manager.IsPart(split));
Assert.IsTrue(manager.IsPart(part1a));
Assert.IsTrue(manager.IsPart(part1b));
Assert.IsTrue(!manager.HasRelations(split));
Assert.IsTrue(!manager.HasRelations(part1a));
Assert.IsTrue(!manager.HasRelations(part1b));
// test: relate the two parts
manager.Relate(part1a, part1b);
Assert.IsTrue(manager.IsSplit(split));
Assert.IsTrue(!manager.IsSplit(part1a));
Assert.IsTrue(!manager.IsSplit(part1b));
Assert.IsTrue(!manager.IsPart(split));
Assert.IsTrue(manager.IsPart(part1a));
Assert.IsTrue(manager.IsPart(part1b));
Assert.IsTrue(!manager.HasRelations(split));
Assert.IsTrue(!manager.HasRelations(part1a));
Assert.IsTrue(!manager.HasRelations(part1b));
}
示例3: 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));
}
示例4: CreateRelationWithNull
public void CreateRelationWithNull()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var one = new Task();
manager.Add(one);
// test: null precedent (no effect)
manager.Relate(null, one);
Assert.IsTrue(manager.HasRelations(one) == false);
Assert.IsTrue(manager.HasRelations(null) == false);
// test: null dependant (no effect)
manager.Relate(one, null);
Assert.IsTrue(manager.HasRelations(one) == false);
Assert.IsTrue(manager.HasRelations(null) == false);
}
示例5: CreateRelationWithUnknownTasks
public void CreateRelationWithUnknownTasks()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var one = new Task();
var two = new Task();
manager.Add(one);
// test: non-added dependant (no effect)
manager.Relate(one, two);
Assert.IsTrue(manager.HasRelations(one) == false);
Assert.IsTrue(manager.HasRelations(two) == false);
// test: non-added precedent (no effect)
manager.Relate(two, one);
Assert.IsTrue(manager.HasRelations(one) == false);
Assert.IsTrue(manager.HasRelations(two) == false);
}
示例6: CircularRelationLevel2
public void CircularRelationLevel2()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var one = new Task();
var two = new Task();
var three = new Task();
manager.Add(one);
manager.Add(two);
manager.Add(three);
// setup: one before two before three;
manager.Relate(one, two);
manager.Relate(two, three);
Assert.IsTrue(manager.HasRelations(one));
Assert.IsTrue(manager.HasRelations(two));
Assert.IsTrue(manager.HasRelations(three));
Assert.IsTrue(manager.DirectDependantsOf(one).Contains(two));
Assert.IsTrue(manager.DirectDependantsOf(two).Contains(three));
Assert.IsTrue(manager.PrecedentsOf(three).Contains(one));
Assert.IsTrue(manager.PrecedentsOf(three).Contains(two));
// test: prevent circular relation (no effect)
manager.Relate(three, one);
Assert.IsTrue(manager.HasRelations(one));
Assert.IsTrue(manager.HasRelations(two));
Assert.IsTrue(manager.HasRelations(three));
Assert.IsTrue(manager.DirectDependantsOf(one).Contains(two));
Assert.IsTrue(manager.DirectDependantsOf(two).Contains(three));
Assert.IsTrue(manager.PrecedentsOf(three).Contains(one));
Assert.IsTrue(manager.PrecedentsOf(three).Contains(two));
}
示例7: CreateRelation
public void CreateRelation()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var one = new Task();
var two = new Task();
manager.Add(one);
manager.Add(two);
// setup: confirms no relations
Assert.IsTrue(manager.DependantsOf(one).Count() == 0);
Assert.IsTrue(manager.PrecedentsOf(two).Count() == 0);
// test: create a relationship
manager.Relate(one, two);
Assert.IsTrue(manager.DependantsOf(one).Contains(two));
Assert.IsTrue(manager.PrecedentsOf(two).Contains(one));
Assert.IsTrue(manager.HasRelations(one));
Assert.IsTrue(manager.HasRelations(two));
}
示例8: RemoveNonExistingRelation
public void RemoveNonExistingRelation()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var one = new Task();
var two = new Task();
manager.Add(one);
manager.Add(two);
// setup: confirm current relations
Assert.IsTrue(manager.HasRelations(one) == false);
Assert.IsTrue(manager.HasRelations(two) == false);
// test: check that there is no effect
manager.Unrelate(one, two);
Assert.IsTrue(manager.HasRelations(one) == false);
Assert.IsTrue(manager.HasRelations(two) == false);
}
示例9: RelateUnrelatePartsBecomeRelateUnrelateSplitTasks
public void RelateUnrelatePartsBecomeRelateUnrelateSplitTasks()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var split1 = new Task();
var part1a = new Task();
var part1b = new Task();
var split2 = new Task();
var part2a = new Task();
var part2b = new Task();
manager.Add(split1);
manager.Add(split2);
// setup: create 2 split tasks each of 2 parts
manager.Split(split1, part1a, part1b, 1);
manager.Split(split2, part2a, part2b, 1);
Assert.IsTrue(!manager.HasRelations(split1));
Assert.IsTrue(!manager.HasRelations(part1a));
Assert.IsTrue(!manager.HasRelations(part1b));
Assert.IsTrue(!manager.HasRelations(split2));
Assert.IsTrue(!manager.HasRelations(part2a));
Assert.IsTrue(!manager.HasRelations(part2b));
// test: relate parts from different splits
manager.Relate(part1a, part2a);
Assert.IsTrue(manager.HasRelations(split1));
Assert.IsTrue(!manager.HasRelations(part1a));
Assert.IsTrue(!manager.HasRelations(part1b));
Assert.IsTrue(manager.HasRelations(split2));
Assert.IsTrue(!manager.HasRelations(part2a));
Assert.IsTrue(!manager.HasRelations(part2b));
// test: relate parts from different splits
manager.Unrelate(part1b, part2b);
Assert.IsTrue(!manager.HasRelations(split1));
Assert.IsTrue(!manager.HasRelations(part1a));
Assert.IsTrue(!manager.HasRelations(part1b));
Assert.IsTrue(!manager.HasRelations(split2));
Assert.IsTrue(!manager.HasRelations(part2a));
Assert.IsTrue(!manager.HasRelations(part2b));
// test: relate parts using different parts
manager.Relate(part2b, part1b);
Assert.IsTrue(manager.HasRelations(split1));
Assert.IsTrue(!manager.HasRelations(part1a));
Assert.IsTrue(!manager.HasRelations(part1b));
Assert.IsTrue(manager.HasRelations(split2));
Assert.IsTrue(!manager.HasRelations(part2a));
Assert.IsTrue(!manager.HasRelations(part2b));
// test: unrelate all
manager.Unrelate(part2a);
Assert.IsTrue(!manager.HasRelations(split1));
Assert.IsTrue(!manager.HasRelations(part1a));
Assert.IsTrue(!manager.HasRelations(part1b));
Assert.IsTrue(!manager.HasRelations(split2));
Assert.IsTrue(!manager.HasRelations(part2a));
Assert.IsTrue(!manager.HasRelations(part2b));
}
示例10: RelateMultipleDependants
public void RelateMultipleDependants()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var one = new Task();
var two = new Task();
var three = new Task();
manager.Add(one);
manager.Add(two);
manager.Add(three);
// setup: confirm no relations exists
Assert.IsTrue(!manager.HasRelations(one));
Assert.IsTrue(!manager.HasRelations(two));
Assert.IsTrue(!manager.HasRelations(three));
// test: multiple relation setup
manager.Relate(one, two);
manager.Relate(one, three);
Assert.IsTrue(manager.HasRelations(one));
Assert.IsTrue(manager.HasRelations(two));
Assert.IsTrue(manager.HasRelations(three));
Assert.IsTrue(manager.DirectDependantsOf(one).Count() == 2);
Assert.IsTrue(manager.DirectPrecedentsOf(two).Count() == 1);
Assert.IsTrue(manager.DirectPrecedentsOf(three).Count() == 1);
}
示例11: RelatedTaskCannotBecomeParts
public void RelatedTaskCannotBecomeParts()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var split = new Task();
var part1 = new Task();
var part2 = new Task();
manager.Add(split);
manager.Add(part1);
manager.Add(part2);
// setup: relate part1 and part2
manager.Relate(part1, part2);
Assert.IsTrue(manager.HasRelations(part1));
Assert.IsTrue(manager.HasRelations(part2));
Assert.IsTrue(manager.DependantsOf(part1).Contains(part2));
// test: split task using part1 and part2
manager.Split(split, part1, part2, 1);
Assert.IsTrue(manager.HasRelations(part1));
Assert.IsTrue(manager.HasRelations(part2));
Assert.IsTrue(manager.DependantsOf(part1).Contains(part2));
Assert.IsTrue(!manager.IsSplit(split));
Assert.IsTrue(!manager.IsPart(part1));
Assert.IsTrue(!manager.IsPart(part2));
}
示例12: 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));
}