本文整理汇总了C#中ProjectManager.SetStart方法的典型用法代码示例。如果您正苦于以下问题:C# ProjectManager.SetStart方法的具体用法?C# ProjectManager.SetStart怎么用?C# ProjectManager.SetStart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectManager
的用法示例。
在下文中一共展示了ProjectManager.SetStart方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AdjustDependantScheduleOnRelate
public void AdjustDependantScheduleOnRelate()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var one = new Task() { Name = "one" };
var two = new Task() { Name = "two" };
manager.Add(one);
manager.Add(two);
// setup: make 2 independant tasks
manager.SetStart(one, 10);
manager.SetDuration(one, 6);
manager.SetStart(two, 10);
manager.SetDuration(two, 10);
Assert.IsTrue(one.Start == 10);
Assert.IsTrue(one.End == 16);
Assert.IsTrue(two.Start == 10);
Assert.IsTrue(two.End == 20);
// test: relate one and two; one before two
manager.Relate(one, two);
Assert.IsTrue(one.Start == 10);
Assert.IsTrue(one.End == 16);
Assert.IsTrue(two.Start == 17);
Assert.IsTrue(two.End == 27);
}
示例2: AdjustGroupScheduleOnGroup
public void AdjustGroupScheduleOnGroup()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var group = new Task();
var one = new Task();
manager.Add(group);
manager.Add(one);
// setup: set initial task parameters
manager.SetStart(group, 6);
manager.SetDuration(group, 5);
manager.SetStart(one, 9);
manager.SetEnd(one, 15);
Assert.IsTrue(group.Start == 6);
Assert.IsTrue(group.End == 11);
Assert.IsTrue(one.Start == 9);
Assert.IsTrue(one.Duration == 6);
// test: make a group and group make have same parameters as one
manager.Group(group, one);
Assert.IsTrue(group.Start == one.Start);
Assert.IsTrue(group.End == one.End);
Assert.IsTrue(group.Duration == one.Duration);
Assert.IsTrue(group.Complete == one.Complete);
}
示例3: AdjustGroupDurationOnUngroup
public void AdjustGroupDurationOnUngroup()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var split = new Task();
var part1 = new Task();
var part2 = new Task();
var group = new Task();
var task = new Task();
manager.Add(group);
manager.Add(split);
manager.Add(task);
// setup: create a group and split under it
manager.Split(split, part1, part2, 1);
manager.Group(group, part1); // intentionall group using part
manager.Group(group, task);
manager.SetDuration(part1, 30);
manager.SetDuration(part2, 15);
manager.SetDuration(task, 20);
manager.SetStart(task, 50);
Assert.IsTrue(group.Duration == 70);
// test: ungroup part should ungroup split task
manager.Ungroup(group, part1);
Assert.IsTrue(group.Duration == 20);
}
示例4: 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);
}
示例5: AdjustGroupScheduleOnMemberScheduleChange
public void AdjustGroupScheduleOnMemberScheduleChange()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var group = new Task() { Name = "group" };
var one = new Task() { Name = "one" };
var two = new Task() { Name = "two" };
manager.Add(group);
manager.Add(one);
manager.Add(two);
// setup: create a group with 2 members and some initial schedule
manager.Group(group, one);
manager.Group(group, two);
manager.SetStart(one, 10);
manager.SetDuration(one, 6);
manager.SetStart(two, 12);
manager.SetEnd(two, 20);
Assert.IsTrue(one.Start == 10);
Assert.IsTrue(one.End == 16);
Assert.IsTrue(two.Start == 12);
Assert.IsTrue(two.Duration == 8);
Assert.IsTrue(group.Start == 10);
Assert.IsTrue(group.End == 20);
Assert.IsTrue(group.Duration == 10, string.Format("Expected {0} != {1}", 10, group.Duration));
// test: change the member schedule and confirm if the group schedule updates approperiately
manager.SetStart(one, 26);
Assert.IsTrue(group.Start == 12);
Assert.IsTrue(group.End == 32);
// test: change the member schedule back
manager.SetStart(one, 10);
Assert.IsTrue(group.Start == 10);
Assert.IsTrue(group.End == 20);
Assert.IsTrue(group.Duration == 10);
}
示例6: RelateBeforePrecedentEndsLate
public void RelateBeforePrecedentEndsLate()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var one = new Task() { Name = "one" };
var two = new Task() { Name = "two" };
manager.Add(one);
manager.Add(two);
// setup: set task parameters and set relation
manager.Relate(one, two);
manager.SetStart(one, 10);
manager.SetDuration(one, 5);
manager.SetStart(two, 18);
manager.SetDuration(two, 12);
Assert.IsTrue(one.Start == 10);
Assert.IsTrue(one.End == 15);
Assert.IsTrue(one.Slack == 2, string.Format("Expected {0} != {1}", 2, one.Slack));
Assert.IsTrue(two.Start == 18);
Assert.IsTrue(two.End == 30);
Assert.IsTrue(two.Slack == 0);
}
示例7: SetSplitSchedule
public void SetSplitSchedule()
{
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 regular task of 30 duration
manager.SetStart(split, 12);
manager.SetDuration(split, 30);
Assert.IsTrue(split.Start == 12);
Assert.IsTrue(split.Duration == 30);
Assert.IsTrue(split.End == 42);
// test: split task and get the correct 10 unit duration back for each part
manager.Split(split, part1, part2, 10);
manager.Split(part2, part3, 10);
Assert.IsTrue(part1.Duration == 10);
Assert.IsTrue(part1.Start == 12);
Assert.IsTrue(part1.End == 22);
Assert.IsTrue(part2.Duration == 10);
Assert.IsTrue(part2.Start == 23);
Assert.IsTrue(part2.End == 33);
Assert.IsTrue(part3.Duration == 10);
Assert.IsTrue(part3.Start == 34);
Assert.IsTrue(part3.End == 44);
Assert.IsTrue(split.Start == 12);
Assert.IsTrue(split.Duration == 32);
Assert.IsTrue(split.End == 44);
}
示例8: 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);
}
示例9: PrecendentPushingDependantLater
public void PrecendentPushingDependantLater()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var one = new Task() { Name = "one" };
var two = new Task() { Name = "two" };
manager.Add(one);
manager.Add(two);
// setup: set task parameters and set relation
manager.Relate(one, two);
manager.SetStart(one, 10);
manager.SetDuration(one, 5);
manager.SetStart(two, 18);
manager.SetDuration(two, 12);
Assert.IsTrue(one.Start == 10);
Assert.IsTrue(one.End == 15);
Assert.IsTrue(one.Slack == 2, string.Format("Expected {0} != {1}", 2, one.Slack));
Assert.IsTrue(two.Start == 18);
Assert.IsTrue(two.End == 30);
Assert.IsTrue(two.Slack == 0);
// test: set one end date further than two start date
manager.SetStart(one, 15);
Assert.IsTrue(one.Start == 15);
Assert.IsTrue(one.End == 20);
Assert.IsTrue(one.Slack == 0, string.Format("Expected {0} != {1}", 1, one.Slack));
Assert.IsTrue(two.Start == 21);
Assert.IsTrue(two.End == 33, string.Format("Expected {0} != {1}", 33, two.End));
Assert.IsTrue(one.Slack == 0);
}
示例10: ExampleFull
/// <summary>
/// Example starts here
/// </summary>
public ExampleFull()
{
InitializeComponent();
// Create a Project and some Tasks
_mManager = new ProjectManager();
var work = new MyTask(_mManager) { Name = "Prepare for Work" };
var wake = new MyTask(_mManager) { Name = "Wake Up" };
var teeth = new MyTask(_mManager) { Name = "Brush Teeth" };
var shower = new MyTask(_mManager) { Name = "Shower" };
var clothes = new MyTask(_mManager) { Name = "Change into New Clothes" };
var hair = new MyTask(_mManager) { Name = "Blow My Hair" };
var pack = new MyTask(_mManager) { Name = "Pack the Suitcase" };
_mManager.Add(work);
_mManager.Add(wake);
_mManager.Add(teeth);
_mManager.Add(shower);
_mManager.Add(clothes);
_mManager.Add(hair);
_mManager.Add(pack);
// Create another 1000 tasks for stress testing
Random rand = new Random();
for (int i = 0; i < 1000; i++)
{
var task = new MyTask(_mManager) { Name = string.Format("New Task {0}", i.ToString()) };
_mManager.Add(task);
_mManager.SetStart(task, rand.Next(300));
_mManager.SetDuration(task, rand.Next(50));
}
// Set task durations, e.g. using ProjectManager methods
_mManager.SetDuration(wake, 3);
_mManager.SetDuration(teeth, 5);
_mManager.SetDuration(shower, 7);
_mManager.SetDuration(clothes, 4);
_mManager.SetDuration(hair, 3);
_mManager.SetDuration(pack, 5);
// demostrate splitting a task
_mManager.Split(pack, new MyTask(_mManager), new MyTask(_mManager), 2);
// Set task complete status, e.g. using newly created properties
wake.Complete = 0.9f;
teeth.Complete = 0.5f;
shower.Complete = 0.4f;
// Give the Tasks some organisation, setting group and precedents
_mManager.Group(work, wake);
_mManager.Group(work, teeth);
_mManager.Group(work, shower);
_mManager.Group(work, clothes);
_mManager.Group(work, hair);
_mManager.Group(work, pack);
_mManager.Relate(wake, teeth);
_mManager.Relate(wake, shower);
_mManager.Relate(shower, clothes);
_mManager.Relate(shower, hair);
_mManager.Relate(hair, pack);
_mManager.Relate(clothes, pack);
// Create and assign Resources.
// MyResource is just custom user class. The API can accept any object as resource.
var jake = new MyResource() { Name = "Jake" };
var peter = new MyResource() { Name = "Peter" };
var john = new MyResource() { Name = "John" };
var lucas = new MyResource() { Name = "Lucas" };
var james = new MyResource() { Name = "James" };
var mary = new MyResource() { Name = "Mary" };
// Add some resources
_mManager.Assign(wake, jake);
_mManager.Assign(wake, peter);
_mManager.Assign(wake, john);
_mManager.Assign(teeth, jake);
_mManager.Assign(teeth, james);
_mManager.Assign(pack, james);
_mManager.Assign(pack, lucas);
_mManager.Assign(shower, mary);
_mManager.Assign(shower, lucas);
_mManager.Assign(shower, john);
// Initialize the Chart with our ProjectManager and CreateTaskDelegate
_mChart.Init(_mManager);
_mChart.CreateTaskDelegate = delegate() { return new MyTask(_mManager); };
// Attach event listeners for events we are interested in
_mChart.TaskMouseOver += new EventHandler<TaskMouseEventArgs>(_mChart_TaskMouseOver);
_mChart.TaskMouseOut += new EventHandler<TaskMouseEventArgs>(_mChart_TaskMouseOut);
_mChart.TaskSelected += new EventHandler<TaskMouseEventArgs>(_mChart_TaskSelected);
_mChart.PaintOverlay += _mOverlay.ChartOverlayPainter;
_mChart.AllowTaskDragDrop = true;
// set some tooltips to show the resources in each task
_mChart.SetToolTip(wake, string.Join(", ", _mManager.ResourcesOf(wake).Select(x => (x as MyResource).Name)));
_mChart.SetToolTip(teeth, string.Join(", ", _mManager.ResourcesOf(teeth).Select(x => (x as MyResource).Name)));
_mChart.SetToolTip(pack, string.Join(", ", _mManager.ResourcesOf(pack).Select(x => (x as MyResource).Name)));
//.........这里部分代码省略.........
示例11: CriticalPath
public void CriticalPath()
{
IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
var one = new Task();
var two = new Task();
var three = new Task();
var four = new Task();
var five = new Task();
var six = new Task();
var seven = new Task();
var eight = new Task();
var nine = new Task();
var group1 = new Task() { Name = "group1" };
var group2 = new Task() { Name = "group2" };
manager.Add(one);
manager.Add(two);
manager.Add(three);
manager.Add(four);
manager.Add(five);
manager.Add(six);
manager.Add(seven);
manager.Add(eight);
manager.Add(nine);
manager.Add(group1);
manager.Add(group2);
// setup: create some schedules and grouping, and confirm we laid it out correctly
manager.Relate(one, two);
manager.Relate(one, three);
manager.Relate(three, four);
manager.Relate(five, six);
manager.Relate(six, four);
manager.Relate(six, seven);
manager.Relate(six, eight);
manager.Relate(eight, nine);
manager.Group(group1, one);
manager.Group(group1, two);
manager.Group(group1, three);
manager.Group(group1, four);
manager.Group(group2, five);
manager.Group(group2, six);
manager.Group(group2, seven);
manager.Group(group2, eight);
manager.SetStart(one, 0); manager.SetEnd(one, 3);
manager.SetStart(two, 4); manager.SetEnd(two, 7);
manager.SetStart(three, 5); manager.SetEnd(three, 8);
manager.SetStart(four, 10); manager.SetEnd(four, 15);
manager.SetStart(five, 1); manager.SetEnd(five, 5);
manager.SetStart(six, 6); manager.SetEnd(six, 9);
manager.SetStart(seven, 12); manager.SetEnd(seven, 15);
manager.SetStart(eight, 11); manager.SetEnd(eight, 16);
manager.SetStart(nine, 17); manager.SetEnd(nine, 20);
Assert.IsTrue(one.Start == 0 && one.Duration == 3, string.Format("Expected ({0}, {1}) != ({2}, {3})", 0, 3, one.Start, one.Duration));
Assert.IsTrue(two.Start == 4 && two.Duration == 3);
Assert.IsTrue(three.Start == 5 && three.Duration == 3);
Assert.IsTrue(four.Start == 10 && four.Duration == 5);
Assert.IsTrue(five.Start == 1 && five.Duration == 4);
Assert.IsTrue(six.Start == 6 && six.Duration == 3);
Assert.IsTrue(seven.Start == 12 && seven.Duration == 3);
Assert.IsTrue(eight.Start == 11 && eight.Duration == 5);
Assert.IsTrue(nine.Start == 17 && nine.Duration == 3, string.Format("Expected ({0}, {1}) != ({2}, {3})", 17, 3, nine.Start, nine.Duration));
var iter_nine = manager.PrecedentsOf(nine).GetEnumerator(); // nine is critical in this setup
iter_nine.MoveNext(); Assert.IsTrue(iter_nine.Current.Equals(eight));
iter_nine.MoveNext(); Assert.IsTrue(iter_nine.Current.Equals(six));
iter_nine.MoveNext(); Assert.IsTrue(iter_nine.Current.Equals(five));
Assert.IsTrue(iter_nine.MoveNext() == false);
// test: change the critical path and see if it gets updated correctly
manager.SetStart(four, 17); // four now ends later than 9;
var critical_paths = manager.CriticalPaths; // should have 2 paths: 4 to 1; and 4 to 5;
Assert.IsTrue(critical_paths.Count() == 2, string.Format("Expected {0} != {1}", 2, critical_paths.Count()));
var critical_tasks = critical_paths.SelectMany(x => x);
Assert.IsTrue(critical_tasks.Distinct().Count() == 6, string.Format("Expected {0} != {1}", 5, critical_tasks.Distinct().Count())); // 4, 3, 1, 6, 5, group1
Assert.IsTrue(critical_tasks.Contains(four));
Assert.IsTrue(critical_tasks.Contains(three));
Assert.IsTrue(critical_tasks.Contains(one));
Assert.IsTrue(critical_tasks.Contains(six));
Assert.IsTrue(critical_tasks.Contains(five));
Assert.IsTrue(critical_tasks.Contains(group1));
}
示例12: MovePartEarlierStart
public void MovePartEarlierStart()
{
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 with extra interrupt in between
manager.SetStart(split, 0);
manager.SetDuration(split, 30);
manager.Split(split, part1, part2, 10);
manager.Split(part2, part3, 10);
manager.SetStart(part2, 16);
manager.SetStart(part3, 32);
Assert.IsTrue(part1.Duration == 10);
Assert.IsTrue(part1.Start == 0);
Assert.IsTrue(part1.End == 10);
Assert.IsTrue(part2.Duration == 10);
Assert.IsTrue(part2.Start == 16);
Assert.IsTrue(part2.End == 26);
Assert.IsTrue(part3.Duration == 10);
Assert.IsTrue(part3.Start == 32);
Assert.IsTrue(part3.End == 42);
Assert.IsTrue(split.Start == 0);
Assert.IsTrue(split.Duration == 42);
Assert.IsTrue(split.End == 42);
// test: start part3 slight earlier
manager.SetStart(part3, 28);
Assert.IsTrue(part1.Duration == 10);
Assert.IsTrue(part1.Start == 0);
Assert.IsTrue(part1.End == 10);
Assert.IsTrue(part2.Duration == 10);
Assert.IsTrue(part2.Start == 16);
Assert.IsTrue(part2.End == 26);
Assert.IsTrue(part3.Duration == 10);
Assert.IsTrue(part3.Start == 28);
Assert.IsTrue(part3.End == 38);
Assert.IsTrue(split.Start == 0);
Assert.IsTrue(split.Duration == 38);
Assert.IsTrue(split.End == 38);
}
示例13: MovePartLaterOverlap
public void MovePartLaterOverlap()
{
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, 0);
manager.SetDuration(split, 30);
manager.Split(split, part1, part2, 10);
manager.Split(part2, part3, 10);
Assert.IsTrue(part1.Duration == 10);
Assert.IsTrue(part1.Start == 0);
Assert.IsTrue(part1.End == 10);
Assert.IsTrue(part2.Duration == 10);
Assert.IsTrue(part2.Start == 11);
Assert.IsTrue(part2.End == 21);
Assert.IsTrue(part3.Duration == 10);
Assert.IsTrue(part3.Start == 22);
Assert.IsTrue(part3.End == 32);
Assert.IsTrue(split.Start == 0);
Assert.IsTrue(split.Duration == 32);
Assert.IsTrue(split.End == 32);
// test: move part1 to overlap with part2, should pack parts to get earliest end date
// with at least 1 time unit interrupt between each part
manager.SetStart(part1, 12);
Assert.IsTrue(part1.Duration == 10);
Assert.IsTrue(part1.Start == 12);
Assert.IsTrue(part1.End == 22);
Assert.IsTrue(part2.Duration == 10);
Assert.IsTrue(part2.Start == 23);
Assert.IsTrue(part2.End == 33);
Assert.IsTrue(part3.Duration == 10);
Assert.IsTrue(part3.Start == 34);
Assert.IsTrue(part3.End == 44);
Assert.IsTrue(split.Start == 12);
Assert.IsTrue(split.Duration == 32);
Assert.IsTrue(split.End == 44);
}
示例14: MovePartEarlierOverlap
public void MovePartEarlierOverlap()
{
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 with extra interrupt in between
manager.SetStart(split, 0);
manager.SetDuration(split, 30);
manager.Split(split, part1, part2, 10);
manager.Split(part2, part3, 10);
manager.SetStart(part2, 16);
manager.SetStart(part3, 32);
Assert.IsTrue(part1.Duration == 10);
Assert.IsTrue(part1.Start == 0);
Assert.IsTrue(part1.End == 10);
Assert.IsTrue(part2.Duration == 10);
Assert.IsTrue(part2.Start == 16);
Assert.IsTrue(part2.End == 26);
Assert.IsTrue(part3.Duration == 10);
Assert.IsTrue(part3.Start == 32);
Assert.IsTrue(part3.End == 42);
Assert.IsTrue(split.Start == 0);
Assert.IsTrue(split.Duration == 42);
Assert.IsTrue(split.End == 42);
// test: move part3 earlier, should pack parts to get earliest end date while start date remain
manager.SetStart(part3, 26);
Assert.IsTrue(part1.Duration == 10);
Assert.IsTrue(part1.Start == 0);
Assert.IsTrue(part1.End == 10);
Assert.IsTrue(part2.Duration == 10);
Assert.IsTrue(part2.Start == 15);
Assert.IsTrue(part2.End == 25);
Assert.IsTrue(part3.Duration == 10);
Assert.IsTrue(part3.Start == 26);
Assert.IsTrue(part3.End == 36);
Assert.IsTrue(split.Start == 0);
Assert.IsTrue(split.Duration == 36);
Assert.IsTrue(split.End == 36);
// test: move part3 even earlier, tight packing
manager.SetStart(part3, 1);
Assert.IsTrue(part1.Duration == 10);
Assert.IsTrue(part1.Start == 0);
Assert.IsTrue(part1.End == 10);
Assert.IsTrue(part2.Duration == 10);
Assert.IsTrue(part2.Start == 11);
Assert.IsTrue(part2.End == 21);
Assert.IsTrue(part3.Duration == 10);
Assert.IsTrue(part3.Start == 22);
Assert.IsTrue(part3.End == 32);
Assert.IsTrue(split.Start == 0);
Assert.IsTrue(split.Duration == 32);
Assert.IsTrue(split.End == 32);
}
示例15: DurationCannotLessThanOne
public void DurationCannotLessThanOne()
{
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);
Assert.IsTrue(one.Duration == 6);
// test: moving the end point
manager.SetEnd(one, 10);
Assert.IsTrue(one.Duration == 1);
// test: moving the duration point
manager.SetDuration(one, -5);
Assert.IsTrue(one.Duration == 1);
}