public void GetNextPlannedTaskTest() { var p = new MockPlanning(); var firstTask = new MockTask(); var secondTask = new MockTask(); var lastTask = new MockTask(); p.SetContent(new List <IWeek> { new IWeek(new List <AbstractDay> { new Day(new List <AbstractTask> { firstTask }), new Day(), new Day(), new Day(), new Day(), new Day(), new Day(), }), new IWeek(new List <AbstractDay> { new Day(new List <AbstractTask> { secondTask }), new Day(), new Day(), new Day(), new Day(), new Day(), new Day(new List <AbstractTask> { lastTask }), }) }); var curDay = p.GetCurrentDay(); var resultFirstTask = p.GetNextPlannedTask(); Assert.AreEqual(firstTask, resultFirstTask); firstTask.IsFinished = true; var resultSecondTask = p.GetNextPlannedTask(); Assert.AreEqual(secondTask, resultSecondTask); // Verify that the current task has no difference with the current day Assert.AreEqual(curDay, p.GetCurrentDay()); Assert.AreEqual(secondTask, p.GetNextPlannedTask()); p.currentDayIndex = 10; Assert.AreEqual(lastTask, p.GetNextPlannedTask()); }
public void SkipDayTest() { var p = new MockPlanning(); var dayToSkip = new Day(new List <AbstractTask> { new MockTask() }); p.SetContent(new List <IWeek> { new IWeek ( new List <AbstractDay> { dayToSkip, new Day(), new Day(), new Day(), new Day(), new Day(), new Day() } ) }); var curDayBeforeSkip = 0; // The current day, which is also the day to skip, has a task Assert.IsNotNull(p.GetNextPlannedTask()); // At first its normal that the day isn't as pos 1, its pos 0 Assert.AreNotEqual(p.GetDays()[1], dayToSkip); p.SkipDay(dayToSkip); // We verify that we are still the same day Assert.AreEqual(0, curDayBeforeSkip); // But we skipped it, so we don't have any task to do, so null reference for the task Assert.IsNull(p.GetNextPlannedTask()); // Skip the planning until we reach the end to see if it will finish }
public void DecalWeekTest() { var p = new MockPlanning(); var dayToDecal = new Day(new List <AbstractTask> { new MockTask() }); p.SetContent(new List <IWeek> { new IWeek ( new List <AbstractDay> { dayToDecal, new Day(), new Day(), new Day(), new Day(), new Day(), new Day() } ) }); var curDayBeforeDecal = 0; // At first its normal that the day isn't as pos 1, its pos 0 Assert.AreNotEqual(p.GetDays()[1], dayToDecal); //Roadmap r = new Roadmap(p); //r.PrintRoadmap(); p.DecalWeek(dayToDecal); // But we decaled it //r.PrintRoadmap(); Assert.AreEqual(p.GetDays()[7], dayToDecal); // After we decaled the day, the current day index didn't change, we don't want to start the next day & work! Assert.IsTrue(curDayBeforeDecal == 0); // Verify that the week is unchanged // Check If the task is still available, it should be available because we didn't cancel the task, we posponed it Assert.IsTrue(p.GetNextPlannedTask() != null); Console.WriteLine("After decal\n" + p); }