Ejemplo n.º 1
0
        public void EditSchedule_RemovingOneAddingOneDay_ReturnsCorrectValue()
        {
            var worker = new Worker
            {
                ID = 1,
                PreferedDays = new Dictionary<DayOfWeek, Worker.Ranking>
                {
                    {DayOfWeek.Monday, Worker.Ranking.Yes},
                    {DayOfWeek.Wednesday, Worker.Ranking.Yes},
                    {DayOfWeek.Friday, Worker.Ranking.Yes}
                }
            };

            var daysToChange = new Dictionary<DayOfWeek, Worker.Ranking>
            {
                {DayOfWeek.Wednesday, Worker.Ranking.No},
                {DayOfWeek.Thursday, Worker.Ranking.Yes}
            };

            //can't work Wednesday, but can Thursday
            worker.EditSchedule(daysToChange);

            Assert.AreEqual((int)worker.PreferedDays[DayOfWeek.Wednesday], -1);
            Assert.AreEqual((int)worker.PreferedDays[DayOfWeek.Thursday], 1);
        }
Ejemplo n.º 2
0
        public void EditSchedule_GoingFromThreeToTwoDays_ReturnsCorrectValue()
        {
            var worker = new Worker
            {
                ID = 1,
                PreferedDays = new Dictionary<DayOfWeek, Worker.Ranking>
                {
                    {DayOfWeek.Monday, Worker.Ranking.Yes},
                    {DayOfWeek.Wednesday, Worker.Ranking.Yes},
                    {DayOfWeek.Friday, Worker.Ranking.Yes}
                }
            };

            //can't work wednesday
            worker.EditSchedule(DayOfWeek.Wednesday, Worker.Ranking.No);

            Assert.AreEqual((int)worker.PreferedDays[DayOfWeek.Wednesday], -1);
        }