public void WriteWorkdayToFile()
        {
            var fileReaderWriter = new FileReaderWriter<Workday>(new BinaryFormatter(), "workday_test.dat");
            var workday = new Workday();

            fileReaderWriter.Write(workday);
        }
        public void CanUpdateExistingWorkday()
        {
            var workday = new Workday(_someDate, new EntryExitTime(), new MutableTimeSpan());

            _workdayRepository.Update(workday);

            Assert.Same(_workdayRepository.FindWorkdayBy(_someDate), workday);
        }
        public void CanAddNewWorkday()
        {
            var notExistingDate = new Date(7, 6, 1990);
            var workday = new Workday(notExistingDate, new EntryExitTime(), new MutableTimeSpan());

            _workdayRepository.Add(workday);

            Assert.Same(_workdayRepository.FindWorkdayBy(notExistingDate), workday);
        }
        public void WriteAndReadWorkdayAndCheckForValue()
        {
            var fileReaderWriter = new FileReaderWriter<Workday>(new BinaryFormatter(), "workday_test.dat");
            var workday = new Workday(new Date(6, 6, 1990), new EntryExitTime(), new MutableTimeSpan());

            fileReaderWriter.Write(workday);
            var readWorkday = fileReaderWriter.Read();

            Assert.Equal(workday.Date.Year, readWorkday.Date.Year);
        }
        public void ThrowsOnDeletionOfNonExisitingWorkday()
        {
            var workday = new Workday(_someDate, new EntryExitTime(), new MutableTimeSpan());

            Assert.Throws<ArgumentOutOfRangeException>(() => _workdayRepository.Delete(workday));
        }
        public void ThrowsOnAdditionOfWorkdayWithExistingDate()
        {
            var workday = new Workday(_someDate, new EntryExitTime(), new MutableTimeSpan());

            Assert.Throws<ArgumentException>(() => _workdayRepository.Add(workday));
        }
        public void ThrowsOnUpdateOfNonExistingWorkday()
        {
            var nonExisitingDate = new Date(4, 4, 1999);
            var workday = new Workday(nonExisitingDate, new EntryExitTime(), new MutableTimeSpan());

            Assert.Throws<ArgumentOutOfRangeException>(() => _workdayRepository.Update(workday));
        }