本文整理汇总了C#中ProjectManager.SetComplete方法的典型用法代码示例。如果您正苦于以下问题:C# ProjectManager.SetComplete方法的具体用法?C# ProjectManager.SetComplete怎么用?C# ProjectManager.SetComplete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectManager
的用法示例。
在下文中一共展示了ProjectManager.SetComplete方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AdjustGroupCompleteOnMemberCompleteChange
public void AdjustGroupCompleteOnMemberCompleteChange()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var group = new Task() { Name = "group" };
var member = new Task() { Name = "member" };
manager.Add(group);
manager.Add(member);
// setup: create a group
manager.Group(group, member);
Assert.IsTrue(member.Complete == 0);
Assert.IsTrue(group.Complete == 0, string.Format("Expected {0} != {1}", 0, group.Complete));
// test: set the complete on the member and
manager.SetComplete(member, 0.5f);
Assert.IsTrue(member.Complete == 0.5f);
Assert.IsTrue(group.Complete == 0.5f, string.Format("Expected {0} != {1}", 0.5f, group.Complete));
}
示例2: CannotSetCompleteOnSplitTask
public void CannotSetCompleteOnSplitTask()
{
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.SetComplete(split, 0.2f);
manager.Split(split, part1, part2, 1);
Assert.IsTrue(split.Complete == 0);
Assert.IsTrue(part1.Complete == 0);
Assert.IsTrue(part2.Complete == 0);
// test: changing complete on split will not have effect
manager.SetComplete(split, 10);
Assert.IsTrue(split.Complete == 0);
Assert.IsTrue(part1.Complete == 0);
Assert.IsTrue(part2.Complete == 0);
}
示例3: SetTaskParameters
public void SetTaskParameters()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var one = new Task();
manager.Add(one);
// setup: set some initial values
manager.SetStart(one, 22);
manager.SetEnd(one, 24);
manager.SetComplete(one, 0.3f);
manager.SetCollapse(one, false);
Assert.IsTrue(one.Start == 22);
Assert.IsTrue(one.End == 24);
Assert.IsTrue(one.Complete == 0.3f);
Assert.IsTrue(one.IsCollapsed == false);
Assert.IsTrue(one.Slack == 0);
Assert.IsTrue(one.Duration == 2);
// test: change the values and check again
manager.SetStart(one, 34);
manager.SetDuration(one, 56);
manager.SetComplete(one, 0.9f);
manager.SetCollapse(one, true); // should have no effect unless on group
Assert.IsTrue(one.Start == 34);
Assert.IsTrue(one.End == 90);
Assert.IsTrue(one.Complete == 0.9f);
Assert.IsTrue(one.IsCollapsed == false);
Assert.IsTrue(one.Slack == 0);
Assert.IsTrue(one.Duration == 56);
}
示例4: SetPartCompleteUpdatesSplitTaskAndGroup
public void SetPartCompleteUpdatesSplitTaskAndGroup()
{
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 member = new Task() { Name = "member" };
manager.Add(split);
manager.Add(member);
manager.Add(group);
// setup: create split task under a group
manager.SetDuration(split, 6);
manager.SetDuration(member, 14);
manager.Group(group, split);
manager.Group(group, member);
manager.Split(split, part1, part2, 2);
Assert.IsTrue(manager.IsGroup(group));
Assert.IsTrue(manager.IsMember(member));
Assert.IsTrue(manager.IsMember(split));
Assert.IsTrue(group.Complete == 0);
Assert.IsTrue(split.Complete == 0);
Assert.IsTrue(part1.Complete == 0);
Assert.IsTrue(part2.Complete == 0);
Assert.IsTrue(group.Duration == 14);
Assert.IsTrue(member.Duration == 14);
Assert.IsTrue(split.Duration == 7);
Assert.IsTrue(part1.Duration == 2);
Assert.IsTrue(part2.Duration == 4);
// test: set complete for part1 and see group and split complete increase
manager.SetComplete(part1, 0.3f);
Assert.IsTrue(Math.Abs(split.Complete - (0.3f * 2) / 6.0f) < 0.01f);
Assert.IsTrue(Math.Abs(group.Complete - (split.Complete * 7) / 20.0f) < 0.01f);
}
示例5: CompleteMustBetweenZeroAndOne
public void CompleteMustBetweenZeroAndOne()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var one = new Task();
manager.Add(one);
// setup: set initial value
manager.SetStart(one, 14);
manager.SetEnd(one, 20);
manager.SetComplete(one, 0.5f);
Assert.IsTrue(one.Duration == 6);
Assert.IsTrue(one.Complete == 0.5f);
// test: complete > 1 become 1
manager.SetComplete(one, 25.4f);
Assert.IsTrue(one.Complete == 1);
// test: complete < 0 become 0
manager.SetComplete(one, -33.8f);
Assert.IsTrue(one.Complete == 0);
}
示例6: CannotSetCompleteOnGroup
public void CannotSetCompleteOnGroup()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var group = new Task() { Name = "group" };
var member = new Task() { Name = "member" };
manager.Add(group);
manager.Add(member);
// setup: set an initial complete on group
manager.SetComplete(group, 0.345f);
Assert.IsTrue(group.Complete == 0.345f);
Assert.IsTrue(member.Complete == 0);
// test: make a group and reset its complete status
manager.Group(group, member);
Assert.IsTrue(manager.IsGroup(group));
Assert.IsTrue(group.Complete == 0);
Assert.IsTrue(member.Complete == 0);
// test: set complete on a group (no effect);
manager.SetComplete(group, 0.123f);
Assert.IsTrue(manager.IsGroup(group));
Assert.IsTrue(group.Complete == 0);
Assert.IsTrue(member.Complete == 0);
}