public void DateIntervalController_TimeIntervalModify()
        {
            // Arrange
            int      lId     = 1;
            int      lTimeId = 19;
            TimeSpan lNewEnd = new TimeSpan(20, 0, 0);

            ManageScheduleHandler lController = new ManageScheduleHandler();
            //  var mock = new Mock<DateIntervalController>(IoCUnityContainerLocator.Container.Resolve<IUnitOfWork>());

            ScheduleDTO      lDto;
            ScheduleDTO      lResult;
            ScheduleEntryDTO lTimeInterval;

            // Act
            lDto                  = lController.GetSchedule(lId);
            lTimeInterval         = lDto.ActiveHours.Where(ti => ti.EndTime.Hours == lTimeId).SingleOrDefault();
            lTimeInterval.EndTime = lNewEnd;
            lController.ModifySchedule(lDto);
            // mock.Object.Save(lDto);
            // mock.Verify(foo => foo.Save(It.IsAny<ScheduleDTO>()), Times.Never());


            // Assert
            lResult = lController.GetSchedule(lId);
            this.AssertAreEqualForUpdating(lDto, lResult);
        }
        public void DateIntervalController_TimeIntervalAdd()
        {
            // Arrange
            int      lId       = 1;
            TimeSpan lNewEnd   = new TimeSpan(22, 0, 0);
            TimeSpan lNewStart = new TimeSpan(20, 0, 0);

            ManageScheduleHandler lController = new ManageScheduleHandler();
            ScheduleDTO           lResult;
            ScheduleDTO           lDto;
            ScheduleEntryDTO      lNewTime;

            // Act
            lDto = lController.GetSchedule(lId);

            lNewTime = new ScheduleEntryDTO()
            {
                EndTime   = lNewEnd,
                StartTime = lNewStart
            };

            lDto.ActiveHours.Add(lNewTime);
            lController.ModifySchedule(lDto);

            // Assert
            lResult = lController.GetSchedule(lId);
            this.AssertAreEqualForAdding(lDto, lResult);
        }
        public void DateIntervalController_DateModify()
        {
            // Arrange
            int      lId            = 1;
            DateTime lNewActiveFrom = new DateTime(2016, 03, 01);

            ManageScheduleHandler lController = new ManageScheduleHandler();
            ScheduleDTO           lResult;
            ScheduleDTO           lDto;

            // Act
            lDto            = lController.GetSchedule(lId);
            lDto.ActiveFrom = lNewActiveFrom;
            lController.ModifySchedule(lDto);

            // Assert
            lResult = lController.GetSchedule(lId);
            this.AssertAreEqualForUpdating(lDto, lResult);
        }
        public void DateIntervalController_DaysModify()
        {
            // Arrange
            int lId = 1;

            ManageScheduleHandler lController = new ManageScheduleHandler();
            ScheduleDTO           lResult;
            ScheduleDTO           lDto = lController.GetSchedule(lId);

            IList <Days> lDayList = new List <Days>()
            {
                Days.Lunes, Days.Martes, Days.Jueves
            };

            // Act
            lDto.Days = lDayList;
            lController.ModifySchedule(lDto);

            // Assert
            lResult = lController.GetSchedule(lId);
            this.AssertAreEqualForUpdating(lDto, lResult);
        }
        public void DateIntervalController_TimeIntervalDelete()
        {
            // Arrange
            int lId     = 1;
            int lTimeId = 1;

            ManageScheduleHandler lController = new ManageScheduleHandler();
            ScheduleDTO           lDto;
            ScheduleDTO           lResult;
            ScheduleEntryDTO      lTimeInterval;
            ScheduleEntryDTO      lRemoved;

            // Act
            lDto          = lController.GetSchedule(lId);
            lTimeInterval = lDto.ActiveHours.Where(ti => ti.EndTime.Hours == lTimeId).SingleOrDefault();
            lDto.ActiveHours.Remove(lTimeInterval);
            lController.ModifySchedule(lDto);

            // Assert
            lResult  = lController.GetSchedule(lId);
            lRemoved = lResult.ActiveHours.Where(ti => ti.EndTime.Hours == lTimeId).SingleOrDefault();
            Assert.IsNull(lRemoved);
        }