public void CanInsertNewStartDate()
        {
            var someDatePlus5Days = new Date(_someDate.DayOfMonth + 5, _someDate.Month, _someDate.Year);
            var workTimePlan = new DailyWorkTimeWeekPlan();

            _timetable.AddOrUpdateWorkTimePlanBeginningAt(someDatePlus5Days, workTimePlan);

            Assert.Same(workTimePlan, _timetable.FindWorkTimePlanBy(someDatePlus5Days));
        }
        public void CanRetrievePlannedWorkTimeForCertainWeekday()
        {
            var workTimePlanWeek = new DailyWorkTimeWeekPlan();
            var weekday = DayOfWeek.Thursday;

            var plannedWorkTime = workTimePlanWeek.GetPlannedWorkTimeFor(weekday);

            Assert.NotNull(plannedWorkTime);
        }
        public void WriteAndReadDailyWorkTimeWeekPlanAndCheckForValue()
        {
            var fileReaderWriter = new FileReaderWriter<DailyWorkTimeWeekPlan>(new BinaryFormatter(), "workplan_test.dat");
            var dailyWorkTimeWeekPlan = new DailyWorkTimeWeekPlan();
            dailyWorkTimeWeekPlan.GetPlannedWorkTimeFor(DayOfWeek.Monday).Hour = 10;

            fileReaderWriter.Write(dailyWorkTimeWeekPlan);
            var readDailyWorkTimeWeekPlan = fileReaderWriter.Read();

            Assert.Equal(dailyWorkTimeWeekPlan.GetPlannedWorkTimeFor(DayOfWeek.Monday).Hour, readDailyWorkTimeWeekPlan.GetPlannedWorkTimeFor(DayOfWeek.Monday).Hour);
        }
        public void CanModifyPlannedWorkTimeForCertainWeekday()
        {
            var workTimePlanWeek = new DailyWorkTimeWeekPlan();
            var weekday = DayOfWeek.Thursday;
            var newHour = 1;
            var newMinute = 30;

            var plannedWorkTime = workTimePlanWeek.GetPlannedWorkTimeFor(weekday);
            plannedWorkTime.Hour = newHour;
            plannedWorkTime.Minute = newMinute;

            Assert.Equal(workTimePlanWeek.GetPlannedWorkTimeFor(weekday).Hour, newHour);
            Assert.Equal(workTimePlanWeek.GetPlannedWorkTimeFor(weekday).Minute, newMinute);
        }
        public PlannedWorktimeInMemoryRepositoryTests()
        {
            var someDateMinus1Day = new Date(18, 6, 1991);
            _someDate = new Date(19, 6, 1991);

            var someDatePlus10Days = new Date(29, 6, 1991);
            var timetableDictionary = new Dictionary<IDate, IDailyWorkTimeWeekPlan>();
            var modifiableWorkTimePlan = new DailyWorkTimeWeekPlan();
            modifiableWorkTimePlan.GetPlannedWorkTimeFor(DayOfWeek.Wednesday).Hour = 1;
            timetableDictionary[_someDate] = modifiableWorkTimePlan;
            timetableDictionary[someDatePlus10Days] = new DailyWorkTimeWeekPlan();
            timetableDictionary[someDateMinus1Day] = new DailyWorkTimeWeekPlan();
            _timetable = new PlannedWorktimeInMemoryRepository(timetableDictionary);
        }
        public void ThrowsWhenTryingToDeleteNonExistentWorkTimePlan()
        {
            var workTimePlanToDelete = new DailyWorkTimeWeekPlan();

            Assert.Throws<ArgumentOutOfRangeException>(() => _timetable.Delete(workTimePlanToDelete));
        }
 public PlannedWorktimeInMemoryRepository()
     : this(new Dictionary<IDate, IDailyWorkTimeWeekPlan>())
 {
     var now = new Date(DateTime.Now.Day, DateTime.Now.Month, DateTime.Now.Year);
     _timetableOfPlannedWorktime[now] = new DailyWorkTimeWeekPlan();
 }