本文整理汇总了C#中ProjectManager.PartsOf方法的典型用法代码示例。如果您正苦于以下问题:C# ProjectManager.PartsOf方法的具体用法?C# ProjectManager.PartsOf怎么用?C# ProjectManager.PartsOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectManager
的用法示例。
在下文中一共展示了ProjectManager.PartsOf方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SplitTask
public void SplitTask()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var split = new Task();
var part1 = new Task();
var part2 = new Task();
manager.Add(split);
// setup: confirm no split tasks
Assert.IsTrue(!manager.IsSplit(split));
Assert.IsTrue(!manager.IsPart(part1));
Assert.IsTrue(!manager.IsPart(part2));
// test: split the task
manager.Split(split, part1, part2, 1);
Assert.IsTrue(manager.IsSplit(split));
Assert.IsTrue(manager.IsPart(part1));
Assert.IsTrue(manager.IsPart(part2));
Assert.IsTrue(manager.PartsOf(split).Count() == 2);
Assert.IsTrue(manager.PartsOf(split).ElementAt(0).Equals(part1));
Assert.IsTrue(manager.PartsOf(split).ElementAt(1).Equals(part2));
}
示例2: SplitTaskAndConfirmStructure
public void SplitTaskAndConfirmStructure()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var split = new Task();
var part1 = new Task();
var part2 = new Task();
manager.Add(split);
// setup: confirm task type status
Assert.IsTrue(!manager.IsSplit(split));
Assert.IsTrue(!manager.IsSplit(part1));
Assert.IsTrue(!manager.IsSplit(part2));
Assert.IsTrue(!manager.IsPart(split));
Assert.IsTrue(!manager.IsPart(part1));
Assert.IsTrue(!manager.IsPart(part2));
// test: split the task into part1 and part2 and see resulting structure
manager.Split(split, part1, part2, 1);
Assert.IsTrue(manager.IsSplit(split));
Assert.IsTrue(manager.IsPart(part1));
Assert.IsTrue(manager.IsPart(part2));
Assert.IsTrue(!manager.IsPart(split));
Assert.IsTrue(!manager.IsSplit(part1));
Assert.IsTrue(!manager.IsSplit(part2));
Assert.IsTrue(manager.PartsOf(split).Count() == 2);
Assert.IsTrue(manager.PartsOf(split).Contains(part1));
Assert.IsTrue(manager.PartsOf(split).Contains(part2));
}
示例3: SplitPart
public void SplitPart()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var split = new Task();
var part1 = new Task() { Name = "part1" };
var part2 = new Task() { Name = "part2" };
var part3 = new Task() { Name = "part3" };
var part4 = new Task() { Name = "part4" };
manager.Add(split);
// setup: set up a split task
manager.Split(split, part1, part3, 1);
Assert.IsTrue(manager.IsSplit(split));
Assert.IsTrue(manager.IsPart(part1));
Assert.IsTrue(!manager.IsPart(part2));
Assert.IsTrue(manager.IsPart(part3));
Assert.IsTrue(!manager.IsPart(part4));
Assert.IsTrue(manager.PartsOf(split).Count() == 2);
var ele = manager.PartsOf(split);
Assert.IsTrue(manager.PartsOf(split).ElementAt(0).Equals(part1));
Assert.IsTrue(manager.PartsOf(split).ElementAt(1).Equals(part3));
Assert.IsTrue(split.Start == part1.Start);
Assert.IsTrue(split.End == part3.End);
// test: split part3 to give part3 and part4
manager.Split(part3, part4, 1);
Assert.IsTrue(manager.IsSplit(split));
Assert.IsTrue(manager.IsPart(part1));
Assert.IsTrue(!manager.IsPart(part2));
Assert.IsTrue(manager.IsPart(part3));
Assert.IsTrue(manager.IsPart(part4));
Assert.IsTrue(manager.PartsOf(split).Count() == 3);
Assert.IsTrue(manager.PartsOf(split).ElementAt(0).Equals(part1));
Assert.IsTrue(manager.PartsOf(split).ElementAt(1).Equals(part3));
Assert.IsTrue(manager.PartsOf(split).ElementAt(2).Equals(part4));
Assert.IsTrue(split.Start == part1.Start);
Assert.IsTrue(split.End == part4.End);
// test: split part1 to give part1 and part2
manager.Split(part1, part2, 1);
Assert.IsTrue(manager.IsSplit(split));
Assert.IsTrue(manager.IsPart(part1));
Assert.IsTrue(manager.IsPart(part2));
Assert.IsTrue(manager.IsPart(part3));
Assert.IsTrue(manager.IsPart(part4));
Assert.IsTrue(manager.PartsOf(split).Count() == 4);
Assert.IsTrue(manager.PartsOf(split).ElementAt(0) == part1);
Assert.IsTrue(manager.PartsOf(split).ElementAt(1) == part2);
Assert.IsTrue(manager.PartsOf(split).ElementAt(2) == part3);
Assert.IsTrue(manager.PartsOf(split).ElementAt(3) == part4);
Assert.IsTrue(split.Start == part1.Start);
Assert.IsTrue(split.End == part4.End);
// test: ensure no parts overlap
Assert.IsTrue(part1.End < part2.Start);
Assert.IsTrue(part2.End < part3.Start);
Assert.IsTrue(part3.End < part4.Start);
Assert.IsTrue(part1.Start < part1.End);
Assert.IsTrue(part4.Start < part4.End);
}
示例4: SplitPartUsingSamePartsNoEffect
public void SplitPartUsingSamePartsNoEffect()
{
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
manager.Split(split, part1, part2, 1);
Assert.IsTrue(manager.IsSplit(split));
Assert.IsTrue(manager.IsPart(part1));
Assert.IsTrue(manager.IsPart(part2));
Assert.IsTrue(manager.PartsOf(split).Count() == 2);
Assert.IsTrue(manager.PartsOf(split).ElementAt(0).Equals(part1));
Assert.IsTrue(manager.PartsOf(split).ElementAt(1).Equals(part2));
// test: split part1 using part1
manager.Split(part1, part1, 1);
Assert.IsTrue(manager.IsSplit(split));
Assert.IsTrue(manager.IsPart(part1));
Assert.IsTrue(manager.IsPart(part2));
Assert.IsTrue(manager.PartsOf(split).Count() == 2);
Assert.IsTrue(manager.PartsOf(split).ElementAt(0).Equals(part1));
Assert.IsTrue(manager.PartsOf(split).ElementAt(1).Equals(part2));
}
示例5: JoinPartsConfirmPackedSchedule
public void JoinPartsConfirmPackedSchedule()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var split = new Task();
var part1 = new Task();
var part2 = new Task();
var part3 = new Task();
var part4 = new Task();
manager.Add(split);
// setup: create a 4 part split task
manager.SetDuration(split, 40);
manager.Split(split, part1, part2, 5);
manager.Split(part2, part3, 10);
manager.Split(part3, part4, 20);
Assert.IsTrue(part4.Duration == 5);
Assert.IsTrue(part2.Duration == 10);
Assert.IsTrue(manager.IsPart(part1));
Assert.IsTrue(manager.IsPart(part2));
Assert.IsTrue(manager.IsPart(part3));
Assert.IsTrue(manager.IsPart(part4));
Assert.IsTrue(manager.IsSplit(split));
Assert.IsTrue(manager.PartsOf(split).Count() == 4);
Assert.IsTrue(part1.Start == 0);
Assert.IsTrue(part1.End == 5);
Assert.IsTrue(part2.Start == 6);
Assert.IsTrue(part2.End == 16);
Assert.IsTrue(part3.Start == 17);
Assert.IsTrue(part3.End == 37);
Assert.IsTrue(part4.Start == 38);
Assert.IsTrue(part4.End == 43);
// test: join part 2 and 4
manager.Join(part2, part4);
Assert.IsTrue(part2.Duration == 15);
Assert.IsTrue(manager.IsPart(part1));
Assert.IsTrue(manager.IsPart(part2));
Assert.IsTrue(manager.IsPart(part3));
Assert.IsTrue(!manager.IsPart(part4));
Assert.IsTrue(manager.IsSplit(split));
Assert.IsTrue(manager.PartsOf(split).Count() == 3);
Assert.IsTrue(part1.Start == 0);
Assert.IsTrue(part1.End == 5);
Assert.IsTrue(part2.Start == 6);
Assert.IsTrue(part2.End == 21);
Assert.IsTrue(part3.Start == 22);
Assert.IsTrue(part3.End == 42);
}
示例6: MergeSplittedTask
public void MergeSplittedTask()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var split = new Task();
var part1 = new Task();
var part2 = new Task();
var part3 = new Task();
var part4 = new Task();
manager.Add(split);
// setup: create a 4 part split task
manager.Split(split, part1, part2, 1);
manager.Split(part1, part3, 1);
manager.Split(part3, part4, 1);
Assert.IsTrue(manager.IsSplit(split));
Assert.IsTrue(manager.IsPart(part1));
Assert.IsTrue(manager.IsPart(part2));
Assert.IsTrue(manager.IsPart(part3));
Assert.IsTrue(manager.IsPart(part4));
Assert.IsTrue(manager.PartsOf(split).Count() == 4);
Assert.IsTrue(manager.PartsOf(split).ElementAt(0) == part1);
Assert.IsTrue(manager.PartsOf(split).ElementAt(1) == part3);
Assert.IsTrue(manager.PartsOf(split).ElementAt(2) == part4);
Assert.IsTrue(manager.PartsOf(split).ElementAt(3) == part2);
Assert.IsTrue(manager.Tasks.Count() == 1);
// test: merge the split task
manager.Merge(split);
Assert.IsTrue(!manager.IsSplit(split));
Assert.IsTrue(!manager.IsPart(part1));
Assert.IsTrue(!manager.IsPart(part2));
Assert.IsTrue(!manager.IsPart(part3));
Assert.IsTrue(!manager.IsPart(part4));
Assert.IsTrue(manager.Tasks.Count() == 1);
Assert.IsTrue(split.Duration == 4);
}
示例7: JoinParts
public void JoinParts()
{
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 split task with 3 parts
manager.Split(split, part1, part2, 1);
manager.Split(part2, part3, 1);
Assert.IsTrue(manager.IsSplit(split));
Assert.IsTrue(manager.IsPart(part1));
Assert.IsTrue(manager.IsPart(part2));
Assert.IsTrue(manager.IsPart(part3));
Assert.IsTrue(manager.PartsOf(split).Count() == 3);
Assert.IsTrue(manager.PartsOf(split).ElementAt(0) == part1);
Assert.IsTrue(manager.PartsOf(split).ElementAt(1) == part2);
Assert.IsTrue(manager.PartsOf(split).ElementAt(2) == part3);
// test: join part 1 and part2
manager.Join(part1, part2);
Assert.IsTrue(manager.IsSplit(split));
Assert.IsTrue(manager.IsPart(part1));
Assert.IsTrue(!manager.IsPart(part2));
Assert.IsTrue(manager.IsPart(part3));
Assert.IsTrue(manager.PartsOf(split).Count() == 2);
Assert.IsTrue(manager.PartsOf(split).ElementAt(0) == part1);
Assert.IsTrue(manager.PartsOf(split).ElementAt(1) == part3);
}
示例8: JoinPartRemainSinglePartBecomeRegularTask
public void JoinPartRemainSinglePartBecomeRegularTask()
{
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 split task with only part1 and part2
manager.Split(split, part1, part2, 1);
Assert.IsTrue(manager.IsSplit(split));
Assert.IsTrue(manager.IsPart(part1));
Assert.IsTrue(manager.IsPart(part2));
Assert.IsTrue(manager.PartsOf(split).Count() == 2);
Assert.IsTrue(manager.PartsOf(split).ElementAt(0) == part1);
Assert.IsTrue(manager.PartsOf(split).ElementAt(1) == part2);
// test: join the 2 parts, leave only a non-split task left
manager.Join(part1, part2);
Assert.IsTrue(!manager.IsSplit(split));
Assert.IsTrue(!manager.IsPart(part1));
Assert.IsTrue(!manager.IsPart(part2));
Assert.IsTrue(split.Duration == 2);
}
示例9: JoinPartFromDifferentSplitTask
public void JoinPartFromDifferentSplitTask()
{
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
manager.Split(split1, part1a, part1b, 1);
manager.Split(split2, part2a, part2b, 1);
Assert.IsTrue(manager.IsSplit(split1));
Assert.IsTrue(manager.IsSplit(split2));
Assert.IsTrue(manager.IsPart(part1a));
Assert.IsTrue(manager.IsPart(part1b));
Assert.IsTrue(manager.IsPart(part2a));
Assert.IsTrue(manager.IsPart(part2b));
Assert.IsTrue(manager.PartsOf(split1).Count() == 2);
Assert.IsTrue(manager.PartsOf(split1).Contains(part1a));
Assert.IsTrue(manager.PartsOf(split1).Contains(part1b));
Assert.IsTrue(manager.PartsOf(split2).Count() == 2);
Assert.IsTrue(manager.PartsOf(split2).Contains(part2a));
Assert.IsTrue(manager.PartsOf(split2).Contains(part2b));
// test: join part1x with part2x (no effect)
manager.Join(part1a, part2a);
Assert.IsTrue(manager.IsSplit(split1));
Assert.IsTrue(manager.IsSplit(split2));
Assert.IsTrue(manager.IsPart(part1a));
Assert.IsTrue(manager.IsPart(part1b));
Assert.IsTrue(manager.IsPart(part2a));
Assert.IsTrue(manager.IsPart(part2b));
Assert.IsTrue(manager.PartsOf(split1).Count() == 2);
Assert.IsTrue(manager.PartsOf(split1).Contains(part1a));
Assert.IsTrue(manager.PartsOf(split1).Contains(part1b));
Assert.IsTrue(manager.PartsOf(split2).Count() == 2);
Assert.IsTrue(manager.PartsOf(split2).Contains(part2a));
Assert.IsTrue(manager.PartsOf(split2).Contains(part2b));
}
示例10: JoinPartConfirmSchedule
public void JoinPartConfirmSchedule()
{
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
manager.SetStart(split, 16);
manager.SetDuration(split, 24);
manager.Split(split, part1, part2, 8);
manager.Split(part2, part3, 8);
Assert.IsTrue(manager.IsSplit(split));
Assert.IsTrue(manager.PartsOf(split).Count() == 3);
Assert.IsTrue(part1.Duration == 8);
Assert.IsTrue(part2.Duration == 8);
Assert.IsTrue(part3.Duration == 8);
Assert.IsTrue(split.Duration == 26);
Assert.IsTrue(split.Start == 16);
Assert.IsTrue(split.End == 42);
// setup: join parts 1 and 2, intentionally in bad order, but should still work
manager.Join(part2, part1);
Assert.IsTrue(manager.IsSplit(split));
Assert.IsTrue(manager.PartsOf(split).Count() == 2);
Assert.IsTrue(part2.Duration == 16);
Assert.IsTrue(part3.Duration == 8);
Assert.IsTrue(split.Duration == 26); // schedule of other parts not affected
Assert.IsTrue(split.Start == 16);
Assert.IsTrue(split.End == 42);
}
示例11: CannotStartPartBeforeSplitTaskPrecedentStart
public void CannotStartPartBeforeSplitTaskPrecedentStart()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var split = new Task();
var part1 = new Task();
var part2 = new Task();
var precedent = new Task();
manager.Add(split);
manager.Add(precedent);
// setup: create a split task with precendent
manager.SetStart(precedent, 5);
manager.SetDuration(precedent, 5);
manager.SetStart(split, 15);
manager.SetDuration(split, 5);
manager.Relate(precedent, split);
manager.Split(split, part1, part2, 2);
Assert.IsTrue(manager.PrecedentsOf(split).Contains(precedent));
Assert.IsTrue(manager.PartsOf(split).Contains(part1));
Assert.IsTrue(manager.PartsOf(split).Contains(part2));
Assert.IsTrue(precedent.End == 10);
Assert.IsTrue(split.Start == 15);
Assert.IsTrue(part1.Start == 15);
// test: move part1 start before precendent start
manager.SetStart(part1, 8);
Assert.IsTrue(manager.PrecedentsOf(split).Contains(precedent));
Assert.IsTrue(manager.PartsOf(split).Contains(part1));
Assert.IsTrue(manager.PartsOf(split).Contains(part2));
Assert.IsTrue(part1.Start == 11);
Assert.IsTrue(split.Start == 11);
}