예제 #1
0
        public void IsForbiddenExactlyAtEndTime()
        {
            var punchInTime = DateTime.Now;
            var endTime     = punchInTime;

            var shift = new ShiftBuilder()
                        .WithEmployeeId(DefaultEmployeeId)
                        .WithEndTime(endTime).Build();

            shift.CanPunchIn(DefaultEmployeeId, punchInTime).Should().BeFalse();
        }
예제 #2
0
        public void IsForbiddenBeforeShiftStart()
        {
            var shift = new ShiftBuilder()
                        .WithEmployeeId(DefaultEmployeeId)
                        .WithStartTime(DateTime.Now)
                        .WithEndTime(DateTime.Now.AddHours(8))
                        .Build();

            var punchInTime = DateTime.Now.AddHours(-1);

            shift.CanPunchIn(DefaultEmployeeId, punchInTime).Should().BeFalse();
        }
예제 #3
0
        public void IsAllowedExactlyAtShiftStart()
        {
            var punchInTime = DateTime.Now.AddHours(-4);
            var startTime   = punchInTime;

            var shift = new ShiftBuilder()
                        .WithEmployeeId(DefaultEmployeeId)
                        .WithStartTime(startTime)
                        .Build();

            shift.CanPunchIn(DefaultEmployeeId, punchInTime).Should().BeTrue();
        }
예제 #4
0
        public void IsForbiddenForWrongEmployee()
        {
            var otherEmployee = DefaultEmployeeId + 1;

            var shift = new ShiftBuilder()
                        .WithEmployeeId(otherEmployee)
                        .WithStartTime(DateTime.Now)
                        .WithEndTime(DateTime.Now.AddHours(8))
                        .Build();

            var punchInTime = DateTime.Now;

            shift.CanPunchIn(DefaultEmployeeId, punchInTime).Should().BeFalse();
        }