private DashboardOrchestrator GetSut(List <VacancySummary> vacancies)
        {
            var timeProviderMock = new Mock <ITimeProvider>();

            timeProviderMock.Setup(t => t.Today).Returns(_today);

            var dashboardProjection = new EmployerDashboard
            {
                Vacancies = vacancies
            };

            var vacancyClientMock = new Mock <IEmployerVacancyClient>();

            vacancyClientMock.Setup(c => c.GetDashboardAsync(employerAccountId, true))
            .ReturnsAsync(dashboardProjection);

            var userDetails = new User();

            var clientMock = new Mock <IRecruitVacancyClient>();

            clientMock.Setup(c => c.GetUsersDetailsAsync(UserId))
            .ReturnsAsync(userDetails);

            var alertsViewModel   = new AlertsViewModel(null, null, null, null);
            var alertsFactoryMock = new Mock <IEmployerAlertsViewModelFactory>();

            alertsFactoryMock.Setup(a => a.Create(vacancies, userDetails))
            .Returns(alertsViewModel);

            var orch = new DashboardOrchestrator(vacancyClientMock.Object, timeProviderMock.Object, clientMock.Object, alertsFactoryMock.Object);

            return(orch);
        }
Exemple #2
0
 public static DashboardViewModel MapFromEmployerDashboard(EmployerDashboard dashboard)
 {
     return(new DashboardViewModel
     {
         Vacancies = dashboard?.Vacancies
                     .OrderByDescending(v => v.CreatedDate)
                     .ToList() ?? new List <VacancySummary>(),
     });
 }
Exemple #3
0
        public Task UpdateEmployerDashboardAsync(string employerAccountId, IEnumerable <VacancySummary> vacancySummaries)
        {
            var dashboardItem = new EmployerDashboard
            {
                Id          = QueryViewType.EmployerDashboard.GetIdValue(employerAccountId),
                Vacancies   = vacancySummaries,
                LastUpdated = _timeProvider.Now
            };

            return(_queryStore.UpsertAsync(dashboardItem));
        }
Exemple #4
0
        public static EmployerAccountSummary MapFromEmployerDashboard(EmployerDashboard dashboard, string employerAccountId)
        {
            var vacancies = dashboard.Vacancies.ToList();

            return(new EmployerAccountSummary
            {
                EmployerAccountId = employerAccountId,
                TotalNoOfVacancies = vacancies.Count(),
                TotalVacancyStatusCounts = GetTotalVacancyStatusCounts(vacancies),
                LegalEntityVacancySummaries = GetLegalEntities(vacancies)
            });
        }
        private static CreateVacancyOptionsViewModel MapFromDashboard(EmployerDashboard dashboard)
        {
            var summaries = dashboard.CloneableVacancies.Select(x => new ClonableVacancy
            {
                Id = x.Id,
                VacancyReference = x.VacancyReference.Value,
                Summary          = BuildSummaryText(x)
            });

            return(new CreateVacancyOptionsViewModel
            {
                Vacancies = summaries
            });
        }
        private DashboardOrchestrator GetSut(List <VacancySummary> vacancies)
        {
            var timeProviderMock = new Mock <ITimeProvider>();

            timeProviderMock.Setup(t => t.Today).Returns(_today);

            var dashboardProjection = new EmployerDashboard
            {
                Vacancies = vacancies
            };

            var vacancyClientMock = new Mock <IEmployerVacancyClient>();

            vacancyClientMock.Setup(c => c.GetDashboardAsync(employerAccountId, true))
            .ReturnsAsync(dashboardProjection);

            var permissionServiceMock = new Mock <IProviderRelationshipsService>();

            permissionServiceMock.Setup(p => p.GetLegalEntitiesForProviderAsync(employerAccountId, OperationType.RecruitmentRequiresReview))
            .ReturnsAsync(new List <EmployerInfo>());

            var userDetails = new User();

            var clientMock = new Mock <IRecruitVacancyClient>();

            clientMock.Setup(c => c.GetUsersDetailsAsync(UserId))
            .ReturnsAsync(userDetails);

            var alertsViewModel   = new AlertsViewModel(null, null, null, null);
            var alertsFactoryMock = new Mock <IEmployerAlertsViewModelFactory>();

            alertsFactoryMock.Setup(a => a.Create(vacancies, userDetails))
            .Returns(alertsViewModel);

            var orch = new DashboardOrchestrator(vacancyClientMock.Object, timeProviderMock.Object, clientMock.Object, alertsFactoryMock.Object, permissionServiceMock.Object);

            return(orch);
        }