public async Task ThenShouldResolveDataLocksLinkedToAppriceshipWhenStopDateEqualsStartDate()
        {
            var listOfDataLockStatuses = new List<DataLockStatus>
            {
                new DataLockStatus {DataLockEventId = 1},
                new DataLockStatus {DataLockEventId = 2}
            };
            ExampleValidRequest.StopDate = TestApprenticeship.StartDate.Value;
            MockDataLockRepository.Setup(x => x.GetDataLocks(It.IsAny<long>(), false)).ReturnsAsync(listOfDataLockStatuses);

            await Handler.Handle(ExampleValidRequest);

            MockDataLockRepository.Verify(x => x.GetDataLocks(TestApprenticeship.Id, false));
            MockDataLockRepository.Verify(x => x.ResolveDataLock(It.Is<IEnumerable<long>>(p => p.SequenceEqual(new [] {1L, 2L}))));
        }
        public async Task ThenACourseDataLocksThatHaveBeenTriagedAsResetAreResolved()
        {
            var dataLocks = new List <DataLockStatus>
            {
                new DataLockStatus
                {
                    TriageStatus = TriageStatus.Restart,
                    IsResolved   = false,
                    ErrorCode    = DataLockErrorCode.Dlock04
                }
            };

            MockDataLockRepository.Setup(x => x.GetDataLocks(444, false)).ReturnsAsync(dataLocks);

            await Handler.Handle(ExampleValidRequest);

            MockDataLockRepository.Verify(x => x.UpdateDataLockStatus(It.Is <DataLockStatus>(a => a.IsResolved)),
                                          Times.Once);
        }
        public async Task ThenIfStopBackdatedToStartThenAllOutstandingDataLocksAreResolved()
        {
            ExampleValidRequest.DateOfChange = TestApprenticeship.StartDate.Value;

            var dataLocks = new List <DataLockStatus>
            {
                new DataLockStatus
                {
                    DataLockEventId = 1,
                    TriageStatus    = TriageStatus.Restart,
                    IsResolved      = false,
                    ErrorCode       = DataLockErrorCode.Dlock04
                },
                new DataLockStatus
                {
                    DataLockEventId = 2,
                    TriageStatus    = TriageStatus.Unknown,
                    IsResolved      = false,
                    ErrorCode       = DataLockErrorCode.Dlock03
                },
                new DataLockStatus
                {
                    DataLockEventId = 3,
                    TriageStatus    = TriageStatus.Change,
                    IsResolved      = false,
                    ErrorCode       = DataLockErrorCode.Dlock07
                }
            };

            MockDataLockRepository.Setup(x => x.GetDataLocks(444, false)).ReturnsAsync(dataLocks);

            await Handler.Handle(ExampleValidRequest);

            MockDataLockRepository.Verify(x => x.GetDataLocks(TestApprenticeship.Id, false));

            MockDataLockRepository.Verify(x =>
                                          x.ResolveDataLock(It.Is <IEnumerable <long> >(p => p.SequenceEqual(new List <long> {
                1, 2, 3
            }))));
        }