本文整理汇总了C#中ProjectManager.Unrelate方法的典型用法代码示例。如果您正苦于以下问题:C# ProjectManager.Unrelate方法的具体用法?C# ProjectManager.Unrelate怎么用?C# ProjectManager.Unrelate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectManager
的用法示例。
在下文中一共展示了ProjectManager.Unrelate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: RemoveAllDependantsRelation
public void RemoveAllDependantsRelation()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var one = new Task();
var two = new Task();
var three = new Task();
var four = new Task();
manager.Add(one);
manager.Add(two);
manager.Add(three);
manager.Add(four);
// setup: create a relationship
manager.Relate(four, one);
manager.Relate(one, two);
manager.Relate(one, three);
Assert.IsTrue(manager.DependantsOf(one).Contains(three));
Assert.IsTrue(manager.PrecedentsOf(two).Contains(one));
Assert.IsTrue(manager.PrecedentsOf(three).Contains(one));
Assert.IsTrue(manager.DependantsOf(four).Contains(one));
Assert.IsTrue(manager.PrecedentsOf(one).Contains(four));
// test: remove dependants
manager.Unrelate(one);
Assert.IsTrue(manager.DependantsOf(one).Count() == 0);
Assert.IsTrue(manager.PrecedentsOf(two).Count() == 0);
Assert.IsTrue(manager.PrecedentsOf(three).Count() == 0);
Assert.IsTrue(manager.DependantsOf(four).Contains(one));
Assert.IsTrue(manager.PrecedentsOf(one).Contains(four));
}
示例3: RemoveExistingRelation
public void RemoveExistingRelation()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var one = new Task();
var two = new Task();
manager.Add(one);
manager.Add(two);
// setup: create a relationship
manager.Relate(one, two);
Assert.IsTrue(manager.DependantsOf(one).Contains(two));
Assert.IsTrue(manager.PrecedentsOf(two).Contains(one));
// test: remove relation
manager.Unrelate(one, two);
Assert.IsTrue(manager.DependantsOf(one).Count() == 0);
Assert.IsTrue(manager.PrecedentsOf(two).Count() == 0);
}
示例4: 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));
}