public async Task CanCreateWorkItemsFromShiftRecurringWorkitem()
        {
            var dto    = new RecurringWorkItemDto();
            int userId = 1;

            var shift = new Shift()
            {
                Name      = "Shift",
                Id        = 60,
                StartHour = 9,
                EndHour   = 17
            };

            dto.CompletionMode    = CompletionMode.AnyAssigned;
            dto.DescriptionMarkup = "Description";
            dto.Location          = "Location";
            dto.Name     = "Name";
            dto.PatrolId = 1;
            dto.Shifts   = new List <ShiftRecurringWorkItemDto>();
            var shiftRecurringWorkItem = new ShiftRecurringWorkItemDto()
            {
                ScheduledAtHour     = 10,
                ScheduledAtMinute   = 0,
                ShiftAssignmentMode = ShiftAssignmentMode.Auto,
                ShiftId             = shift.Id
            };

            dto.Shifts.Add(shiftRecurringWorkItem);

            var patrol = new Api.Models.Patrol()
            {
                Id       = 1,
                Name     = "Patrol",
                TimeZone = TimeZoneInfo.Local.Id
            };

            _workItemRepository.Setup(x => x.GetShiftRecurringWorkItems(It.IsAny <int>()))
            .Returns(Task.FromResult(new List <ShiftRecurringWorkItem>()
            {
                new ShiftRecurringWorkItem()
                {
                    RecurringWorkItemId = 0,
                    ScheduledAtHour     = 9,
                    ScheduledAtMinute   = 0,
                    ShiftAssignmentMode = ShiftAssignmentMode.Auto,
                    ShiftId             = shift.Id
                }
            }.AsEnumerable()))
            .Verifiable();

            var now = new DateTimeOffset(2001, 1, 1, 0, 0, 0, new TimeSpan());

            _systemClockMock.Setup(x => x.UtcNow).Returns(now);

            _workItemRepository.Setup(x => x.GetWorkItems(It.IsAny <int>(), now.UtcDateTime))
            .Returns(Task.FromResult(new List <WorkItem>()
            {
            }.AsEnumerable()))
            .Verifiable();

            var assignments = new List <ScheduledShiftAssignmentDto>();

            assignments.Add(new ScheduledShiftAssignmentDto()
            {
                Id           = 1,
                AssignedUser = new UserIdentifier()
                {
                    Id = 1, FirstName = "1"
                },
                StartsAt         = new DateTime(2001, 1, 1, 9, 0, 0),
                EndsAt           = new DateTime(2001, 1, 1, 17, 0, 0),
                ScheduledShiftId = 1,
                Shift            = shift
            });
            assignments.Add(new ScheduledShiftAssignmentDto()
            {
                Id           = 2,
                AssignedUser = new UserIdentifier()
                {
                    Id = 2, FirstName = "2"
                },
                StartsAt         = new DateTime(2001, 1, 1, 9, 0, 0),
                EndsAt           = new DateTime(2001, 1, 1, 17, 0, 0),
                ScheduledShiftId = 1,
                Shift            = shift
            });
            assignments.Add(new ScheduledShiftAssignmentDto()
            {
                Id           = 3,
                AssignedUser = new UserIdentifier()
                {
                    Id = 1, FirstName = "1"
                },
                StartsAt         = new DateTime(2001, 1, 2, 9, 0, 0),
                EndsAt           = new DateTime(2001, 1, 2, 17, 0, 0),
                ScheduledShiftId = 2,
                Shift            = shift
            });
            assignments.Add(new ScheduledShiftAssignmentDto()
            {
                Id           = 4,
                AssignedUser = new UserIdentifier()
                {
                    Id = 2, FirstName = "2"
                },
                StartsAt         = new DateTime(2001, 1, 2, 9, 0, 0),
                EndsAt           = new DateTime(2001, 1, 2, 17, 0, 0),
                ScheduledShiftId = 2,
                Shift            = shift
            });

            _shiftRepositoryMock.Setup(x => x.GetScheduledShiftAssignments(dto.PatrolId, null, now.UtcDateTime, null, null, null, null, dto.Shifts.First().ShiftId))
            .Returns(Task.FromResult(assignments.AsEnumerable()))
            .Verifiable();

            _workItemRepository.Setup(x => x.InsertWorkItem(It.Is <WorkItem>(y => y.ScheduledShiftId == 1)))
            .Verifiable();
            _workItemRepository.Setup(x => x.InsertWorkItem(It.Is <WorkItem>(y => y.ScheduledShiftId == 2)))
            .Verifiable();

            await _workItemService.PopulateShiftWorkItemOccurences(dto, now.UtcDateTime, userId, patrol, false);

            _workItemRepository.Verify();
            _shiftRepositoryMock.Verify();
        }