public void CreateNullShiftThrowsException()
        {
            var shiftRepo = new Mock <IShiftRepo>();

            var service = new ShiftService(shiftRepo.Object);

            Exception ex = Assert.Throws <InvalidDataException>(() =>
                                                                service.CreateShift(null));

            Assert.Equal("Shift most not be null", ex.Message);
        }
        public void CreateShiftWithPastDateThrowsException()
        {
            var shiftRepo = new Mock <IShiftRepo>();

            var service = new ShiftService(shiftRepo.Object);

            var shift = new Shift()
            {
                Id          = 1,
                ActiveRoute = true,
                Date        = DateTime.MinValue
            };

            Exception ex = Assert.Throws <InvalidDataException>(() =>
                                                                service.CreateShift(shift));

            Assert.Equal("Shift's date most be after now", ex.Message);
        }
        public void CreateShiftWithPastTimeEndThrowsException()
        {
            var shiftRepo = new Mock <IShiftRepo>();

            var service = new ShiftService(shiftRepo.Object);

            var shift = new Shift()
            {
                Id          = 1,
                ActiveRoute = true,
                Date        = DateTime.Now.AddDays(666),
                TimeStart   = DateTime.MinValue,
                TimeEnd     = DateTime.MinValue.AddDays(3)
            };

            Exception ex = Assert.Throws <InvalidDataException>(() =>
                                                                service.CreateShift(shift));

            Assert.Equal("Shift's time end must be after now", ex.Message);
        }
        public void CreateShiftWithTimeStartOlderThenTimeEndThrowsException()
        {
            var shiftRepo = new Mock <IShiftRepo>();

            var service = new ShiftService(shiftRepo.Object);

            var shift = new Shift()
            {
                Id          = 1,
                ActiveRoute = true,
                Date        = DateTime.Now.AddDays(10),
                TimeStart   = DateTime.Now.AddDays(2),
                TimeEnd     = DateTime.Now.AddDays(1)
            };

            Exception ex = Assert.Throws <InvalidDataException>(() =>
                                                                service.CreateShift(shift));

            Assert.Equal("Shift's TimeStart must be before TimeEnd", ex.Message);
        }