本文整理汇总了C#中ProjectManager.IsPart方法的典型用法代码示例。如果您正苦于以下问题:C# ProjectManager.IsPart方法的具体用法?C# ProjectManager.IsPart怎么用?C# ProjectManager.IsPart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectManager
的用法示例。
在下文中一共展示了ProjectManager.IsPart方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeletePartCausingMerge
public void DeletePartCausingMerge()
{
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 task with resources on parts
manager.Split(split, part1, part2, 1);
Assert.IsTrue(manager.IsSplit(split));
Assert.IsTrue(manager.IsPart(part1));
Assert.IsTrue(manager.IsPart(part2));
// test: delete a part, expect a merge to regular task
manager.Delete(part1);
Assert.IsTrue(!manager.IsSplit(split));
Assert.IsTrue(!manager.IsPart(part1));
Assert.IsTrue(!manager.IsPart(part2));
}
示例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: 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));
}
示例4: SplitTaskUsingRegularTaskNoEffect
public void SplitTaskUsingRegularTaskNoEffect()
{
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 we have 3 regular tasks
Assert.IsTrue(manager.Tasks.Count() == 3);
// test: split one using two and three
manager.Split(one, two, three, 1);
Assert.IsTrue(manager.Tasks.Count() == 3);
Assert.IsTrue(!manager.IsSplit(one));
Assert.IsTrue(!manager.IsPart(two));
Assert.IsTrue(!manager.IsPart(two));
}
示例5: 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));
}
示例6: SplitPartAsThoughItIsTask
public void SplitPartAsThoughItIsTask()
{
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();
var part4 = new Task();
manager.Add(split);
// setup: create a split task with parts
manager.Split(split, part1, part2, 1);
Assert.IsTrue(manager.IsSplit(split));
Assert.IsTrue(!manager.IsSplit(part1));
Assert.IsTrue(manager.IsPart(part1));
Assert.IsTrue(manager.IsPart(part2));
// test: split the part using the split task method
manager.Split(part1, part3, part4, 1);
Assert.IsTrue(!manager.IsSplit(part1));
Assert.IsTrue(manager.IsPart(part1));
Assert.IsTrue(manager.IsPart(part2));
Assert.IsTrue(!manager.IsPart(part3));
Assert.IsTrue(!manager.IsPart(part4));
}
示例7: 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));
}
示例8: 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));
}
示例9: 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);
}
示例10: JoinIntoMerge
public void JoinIntoMerge()
{
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 task
manager.Split(split, part1, part2, 7);
Assert.IsTrue(manager.IsSplit(split));
Assert.IsTrue(manager.IsPart(part1));
Assert.IsTrue(manager.IsPart(part2));
// test: join the two parts, resulting in split becoming back ito regular task
manager.Join(part1, part2);
Assert.IsTrue(!manager.IsSplit(split));
Assert.IsTrue(!manager.IsPart(part1));
Assert.IsTrue(!manager.IsPart(part2));
}
示例11: JoinNullPart
public void JoinNullPart()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var task = new Task();
// test: two nulls (no effect)
manager.Join(null, null);
Assert.IsTrue(manager.Tasks.Count() == 0);
// test: null existing
manager.Join(null, task);
Assert.IsTrue(!manager.IsPart(task));
}
示例12: SetSplitTaskStartMaintainPartsRelativeSchedule
public void SetSplitTaskStartMaintainPartsRelativeSchedule()
{
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
manager.Split(split, part1, part2, 1);
manager.Split(part2, part3, 1);
manager.SetStart(part1, 0);
manager.SetStart(part2, 15);
manager.SetStart(part3, 30);
manager.SetDuration(part1, 3);
manager.SetDuration(part2, 4);
manager.SetDuration(part3, 5);
Assert.IsTrue(manager.IsSplit(split));
Assert.IsTrue(manager.IsPart(part1));
Assert.IsTrue(manager.IsPart(part2));
Assert.IsTrue(manager.IsPart(part3));
Assert.IsTrue(part1.Start == 0);
Assert.IsTrue(part2.Start == 15);
Assert.IsTrue(part3.Start == 30);
Assert.IsTrue(part1.Duration == 3);
Assert.IsTrue(part2.Duration == 4);
Assert.IsTrue(part3.Duration == 5);
Assert.IsTrue(part1.End == 3);
Assert.IsTrue(part2.End == 19);
Assert.IsTrue(part3.End == 35);
// test: move the split task itself - maintain interrupts
var offset = 10 - split.Start;
manager.SetStart(split, 10);
Assert.IsTrue(manager.IsSplit(split));
Assert.IsTrue(manager.IsPart(part1));
Assert.IsTrue(manager.IsPart(part2));
Assert.IsTrue(manager.IsPart(part3));
Assert.IsTrue(part1.Start == 0 + offset);
Assert.IsTrue(part2.Start == 15 + offset);
Assert.IsTrue(part3.Start == 30 + offset);
Assert.IsTrue(part1.Duration == 3);
Assert.IsTrue(part2.Duration == 4);
Assert.IsTrue(part3.Duration == 5);
Assert.IsTrue(part1.End == 3 + offset);
Assert.IsTrue(part2.End == 19 + offset);
Assert.IsTrue(part3.End == 35 + offset);
}
示例13: SetSplitTaskEndLastTaskMinimun1UnitTime
public void SetSplitTaskEndLastTaskMinimun1UnitTime()
{
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
manager.Split(split, part1, part2, 1);
manager.Split(part2, part3, 1);
manager.SetStart(part1, 0);
manager.SetStart(part2, 15);
manager.SetStart(part3, 30);
manager.SetDuration(part1, 3);
manager.SetDuration(part2, 4);
manager.SetDuration(part3, 5);
Assert.IsTrue(manager.IsSplit(split));
Assert.IsTrue(manager.IsPart(part1));
Assert.IsTrue(manager.IsPart(part2));
Assert.IsTrue(manager.IsPart(part3));
Assert.IsTrue(part1.Start == 0);
Assert.IsTrue(part2.Start == 15);
Assert.IsTrue(part3.Start == 30);
Assert.IsTrue(part1.Duration == 3);
Assert.IsTrue(part2.Duration == 4);
Assert.IsTrue(part3.Duration == 5);
Assert.IsTrue(part1.End == 3);
Assert.IsTrue(part2.End == 19);
Assert.IsTrue(part3.End == 35);
// test: set the split task end - last part end to increase or decrease,
// resulting no less than 1 unit duration
manager.SetEnd(split, 1);
Assert.IsTrue(manager.IsSplit(split));
Assert.IsTrue(manager.IsPart(part1));
Assert.IsTrue(manager.IsPart(part2));
Assert.IsTrue(manager.IsPart(part3));
Assert.IsTrue(part1.Start == 0);
Assert.IsTrue(part2.Start == 15);
Assert.IsTrue(part3.Start == 30);
Assert.IsTrue(part1.Duration == 3);
Assert.IsTrue(part2.Duration == 4);
Assert.IsTrue(part3.Duration == 1);
Assert.IsTrue(part1.End == 3);
Assert.IsTrue(part2.End == 19);
Assert.IsTrue(part3.End == 31);
// test: increase split task end and last part adjust accordingly
manager.SetEnd(split, 100);
Assert.IsTrue(part3.End == 100);
Assert.IsTrue(part3.Duration == 70);
Assert.IsTrue(part3.Start == 30);
}
示例14: DeletePartsOnDeleteSplitTask
public void DeletePartsOnDeleteSplitTask()
{
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 task with resources on parts
manager.Split(split, part1, part2, 1);
Assert.IsTrue(manager.IsSplit(split));
Assert.IsTrue(manager.IsPart(part1));
Assert.IsTrue(manager.IsPart(part2));
Assert.IsTrue(manager.Tasks.Count() == 1);
// test: ensure that we cannot add the tasks parts and split again
manager.Add(split);
manager.Add(part1);
manager.Add(part2);
Assert.IsTrue(manager.Tasks.Count() == 1);
// test: delete a part, expect a merge to regular task
manager.Delete(split);
Assert.IsTrue(!manager.IsSplit(split));
Assert.IsTrue(!manager.IsPart(part1));
Assert.IsTrue(!manager.IsPart(part2));
Assert.IsTrue(manager.Tasks.Count() == 0);
// test: if really deleted, we should be able to add them back
manager.Add(split);
Assert.IsTrue(manager.Tasks.Count() == 1);
// test: now we should be able to add again
manager.Add(split);
manager.Add(part1);
manager.Add(part2);
Assert.IsTrue(manager.Tasks.Count() == 3);
}
示例15: SplitNullTaskNoEffect
public void SplitNullTaskNoEffect()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var part1 = new Task();
var part2 = new Task();
// setup: confirm part is not part
Assert.IsTrue(!manager.IsPart(part1));
Assert.IsTrue(!manager.IsPart(part2));
// test: try to split a null task
manager.Split(null, part1, part2, 1);
Assert.IsTrue(!manager.IsPart(part1));
Assert.IsTrue(!manager.IsPart(part2));
}