Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public void GetTasksTest()
        {
            var p = new MockPlanning();

            if (p.GetDays() != null)
            {
                Assert.Fail("The planning had the day list initialized but we didn't add them");
            }
            p.SetContent(new List <IWeek>
            {
                new IWeek(new List <AbstractDay> {
                    new Day(new List <AbstractTask> {
                        new MockTask()
                    }),
                    new Day(),
                    new Day(),
                    new Day(),
                    new Day(),
                    new Day(),
                    new Day()
                }),
                new IWeek(new List <AbstractDay> {
                    new Day(new List <AbstractTask> {
                        new MockTask()
                    }),
                    new Day(),
                    new Day(),
                    new Day(),
                    new Day(),
                    new Day(),
                    new Day(new List <AbstractTask> {
                        new MockTask()
                    }),
                })
            });

            if (p.GetTasks().Count != 3)
            {
                Assert.Fail("There should be 14 days after we added 2 weeks");
            }
        }
Ejemplo n.º 3
0
        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
        }
Ejemplo n.º 4
0
        public void GetWeekCountTest()
        {
            var p          = new MockPlanning();
            var firstTask  = new MockTask();
            var secondTask = 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> {
                        new MockTask()
                    }),
                })
            });

            Assert.AreEqual(2, p.GetWeekCount());
            p.AddDay(new Day());
            Assert.AreEqual(15, p.GetDays().Count);
            Assert.AreEqual(3, p.GetWeekCount());
        }