public async Task ShouldRemovePendingApprovalFromTotalCount()
        {
            MockMediator.Setup(m => m.SendAsync(It.IsAny <GetApprenticeshipsRequest>()))
            .ReturnsAsync(new GetApprenticeshipsResponse {
                Apprenticeships = new List <Domain.Entities.Apprenticeship>
                {
                    new Domain.Entities.Apprenticeship {
                        PaymentStatus = PaymentStatus.Active
                    },
                    new Domain.Entities.Apprenticeship {
                        PaymentStatus = PaymentStatus.PendingApproval
                    }
                },
                TotalCount = 50
            });
            MockApprenticeshipFilter.Setup(m =>
                                           m.Filter(It.IsAny <IList <Types.Apprenticeship.Apprenticeship> >(), It.IsAny <ApprenticeshipSearchQuery>(), Originator.Employer))
            .Returns <IList <Types.Apprenticeship.Apprenticeship>, ApprenticeshipSearchQuery, Originator>((aps, q, o) => new FilterResult(2, aps.ToList(), 1, 25));

            var result = await Orchestrator.GetApprenticeships(1L, new ApprenticeshipSearchQuery());

            MockMediator.Verify(m => m.SendAsync(It.IsAny <GetApprenticeshipsRequest>()), Times.Once);
            MockFacetMapper.Verify(m => m.BuildFacets(It.IsAny <IList <Types.Apprenticeship.Apprenticeship> >(), It.IsAny <ApprenticeshipSearchQuery>(), Originator.Employer), Times.Once);
            MockApprenticeshipFilter.Verify(m => m.Filter(It.IsAny <IList <Types.Apprenticeship.Apprenticeship> >(), It.IsAny <ApprenticeshipSearchQuery>(), Originator.Employer), Times.Once);

            result.Apprenticeships.Count().Should().Be(1);
            result.TotalApprenticeships.Should().Be(2);
            result.TotalApprenticeshipsBeforeFilter.Should().Be(49);
        }
        public async Task ShouldFilterListFromNotApproved()
        {
            MockMediator.Setup(m => m.SendAsync(It.IsAny <GetApprenticeshipsRequest>()))
            .ReturnsAsync(new GetApprenticeshipsResponse
            {
                Apprenticeships = new List <Domain.Entities.Apprenticeship>
                {
                    new Domain.Entities.Apprenticeship {
                        PaymentStatus = Domain.Entities.PaymentStatus.Active
                    },
                    new Domain.Entities.Apprenticeship {
                        PaymentStatus = Domain.Entities.PaymentStatus.PendingApproval
                    },
                    new Domain.Entities.Apprenticeship {
                        PaymentStatus = Domain.Entities.PaymentStatus.Paused
                    }
                }
            });

            // Return same IList<Apprenticeship> as input.
            MockApprenticeshipFilter.Setup(m =>
                                           m.Filter(It.IsAny <IList <Types.Apprenticeship.Apprenticeship> >(), It.IsAny <ApprenticeshipSearchQuery>(), Originator.Employer))
            .Returns <IList <Types.Apprenticeship.Apprenticeship>, ApprenticeshipSearchQuery, Originator>((aps, q, o) => new FilterResult(100, aps.ToList(), 1, 25));

            var result = await Orchestrator.GetApprenticeships(1L, new ApprenticeshipSearchQuery());

            result.Apprenticeships.Count().Should().Be(2);
        }
        public async Task ShouldCallGetFacetAndMapper()
        {
            MockMediator.Setup(m => m.SendAsync(It.IsAny <GetApprenticeshipsRequest>()))
            .ReturnsAsync(new GetApprenticeshipsResponse {
                Apprenticeships = new List <Domain.Entities.Apprenticeship>()
            });
            MockApprenticeshipFilter.Setup(m =>
                                           m.Filter(It.IsAny <IList <Types.Apprenticeship.Apprenticeship> >(), It.IsAny <ApprenticeshipSearchQuery>(), Originator.Employer))
            .Returns <IList <Types.Apprenticeship.Apprenticeship>, ApprenticeshipSearchQuery, Originator>((aps, q, o) => new FilterResult(100, aps.ToList(), 1, 25));

            var result = await Orchestrator.GetApprenticeships(1L, new ApprenticeshipSearchQuery());

            MockMediator.Verify(m => m.SendAsync(It.IsAny <GetApprenticeshipsRequest>()), Times.Once);
            MockFacetMapper.Verify(m => m.BuildFacets(It.IsAny <IList <Types.Apprenticeship.Apprenticeship> >(), It.IsAny <ApprenticeshipSearchQuery>(), Originator.Employer), Times.Once);
            MockApprenticeshipFilter.Verify(m => m.Filter(It.IsAny <IList <Types.Apprenticeship.Apprenticeship> >(), It.IsAny <ApprenticeshipSearchQuery>(), Originator.Employer), Times.Once);

            result.Apprenticeships.Count().Should().Be(0);
        }