public async Task GetFilterApprenticeships([Frozen] GetApprenticeshipsRequest request)
        {
            //Arrange
            request.PageNumber    = 0;
            request.PageItemCount = 0;
            request.ReverseSort   = false;
            request.AccountId     = null;

            //Act
            await _controller.GetApprenticeships(request);

            //Assert
            _mediator.Verify(m => m.Send(
                                 It.Is <GetApprenticeshipsQuery>(r =>
                                                                 r.SearchFilters.SearchTerm.Equals(request.SearchTerm) &&
                                                                 r.SearchFilters.EmployerName.Equals(request.EmployerName) &&
                                                                 r.SearchFilters.CourseName.Equals(request.CourseName) &&
                                                                 r.SearchFilters.Status.Equals(request.Status) &&
                                                                 r.SearchFilters.StartDate.Equals(request.StartDate) &&
                                                                 r.SearchFilters.EndDate.Equals(request.EndDate) &&
                                                                 r.SearchFilters.AccountLegalEntityId.Equals(request.AccountLegalEntityId) &&
                                                                 r.SearchFilters.StartDateRange.From.Equals(request.StartDateRangeFrom) &&
                                                                 r.SearchFilters.StartDateRange.To.Equals(request.StartDateRangeTo)),
                                 It.IsAny <CancellationToken>()), Times.Once);
        }
        public async Task GetEmployerApprentices()
        {
            //Arrange
            var request = new GetApprenticeshipsRequest
            {
                AccountId = 10
            };

            //Act
            await _controller.GetApprenticeships(request);

            //Assert
            _mediator.Verify(m => m.Send(
                                 It.Is <GetApprenticeshipsQuery>(r =>
                                                                 r.EmployerAccountId.Equals(request.AccountId)),
                                 It.IsAny <CancellationToken>()), Times.Once);
        }
        public async Task GetApprenticesByPage([Frozen] GetApprenticeshipsRequest request)
        {
            //Arrange
            request.ReverseSort = false;
            request.AccountId   = null;

            //Act
            await _controller.GetApprenticeships(request);

            //Assert
            _mediator.Verify(m => m.Send(
                                 It.Is <GetApprenticeshipsQuery>(r =>
                                                                 r.ProviderId.Equals(request.ProviderId) &&
                                                                 r.PageNumber.Equals(request.PageNumber) &&
                                                                 r.PageItemCount.Equals(request.PageItemCount)),
                                 It.IsAny <CancellationToken>()), Times.Once);
        }
        public async Task ThenTheQueryResultIsMapped()
        {
            //Arrange
            var expectedProviderId = 10;
            var request            = new GetApprenticeshipsRequest
            {
                ProviderId = expectedProviderId
            };

            _mediator.Setup(x => x.Send(It.Is <GetApprenticeshipsQuery>(c => c.ProviderId.Value.Equals(expectedProviderId)),
                                        It.IsAny <CancellationToken>()))
            .ReturnsAsync(new GetApprenticeshipsQueryResult());

            //Act
            var result = await _controller.GetApprenticeships(request) as OkObjectResult;

            //Assert
            Assert.IsNotNull(result);
            _mapper.Verify(x => x.Map <GetApprenticeshipsResponse>(It.IsAny <GetApprenticeshipsQueryResult>()), Times.Once);
        }