Пример #1
0
 private AlertsViewModel GetAlerts(IEnumerable <VacancySummary> vacancies, User userDetails)
 {
     return(new AlertsViewModel
     {
         EmployerRevokedTransferredVacanciesAlert = _alertViewModelService.GetTransferredVacanciesAlert(vacancies, TransferReason.EmployerRevokedPermission, userDetails.TransferredVacanciesEmployerRevokedPermissionAlertDismissedOn),
         BlockedProviderTransferredVacanciesAlert = _alertViewModelService.GetTransferredVacanciesAlert(vacancies, TransferReason.BlockedByQa, userDetails.TransferredVacanciesBlockedProviderAlertDismissedOn),
         BlockedProviderAlert = _alertViewModelService.GetBlockedProviderVacanciesAlert(vacancies, userDetails.ClosedVacanciesBlockedProviderAlertDismissedOn),
         WithdrawnByQaVacanciesAlert = _alertViewModelService.GetWithdrawnByQaVacanciesAlert(vacancies, userDetails.ClosedVacanciesWithdrawnByQaAlertDismissedOn)
     });
 }
        public void ShouldReturnGroupedProviders(string userLastDismissedDateString, string expectedBlockedProviderNamesCaption)
        {
            var vacancies = GetVacancies();

            var userLastDismissedDate = GetUserDismissedDate(userLastDismissedDateString);

            var sut = new AlertViewModelService();

            var vm = sut.GetBlockedProviderVacanciesAlert(vacancies, userLastDismissedDate);

            vm.BlockedProviderNamesCaption.Should().Be(expectedBlockedProviderNamesCaption);
        }
        public AlertsViewModel Create(IEnumerable <VacancySummary> vacancies, User user)
        {
            var employerRevokedTransferredVacanciesAlert = _alertViewModelService.GetTransferredVacanciesAlert(vacancies, TransferReason.EmployerRevokedPermission, user.TransferredVacanciesEmployerRevokedPermissionAlertDismissedOn);
            var blockedProviderTransferredVacanciesAlert = _alertViewModelService.GetTransferredVacanciesAlert(vacancies, TransferReason.BlockedByQa, user.TransferredVacanciesBlockedProviderAlertDismissedOn);
            var blockedProviderAlert        = _alertViewModelService.GetBlockedProviderVacanciesAlert(vacancies, user.ClosedVacanciesBlockedProviderAlertDismissedOn);
            var withdrawnByQaVacanciesAlert = _alertViewModelService.GetWithdrawnByQaVacanciesAlert(vacancies, user.ClosedVacanciesWithdrawnByQaAlertDismissedOn);

            return(new AlertsViewModel(
                       employerRevokedTransferredVacanciesAlert,
                       blockedProviderTransferredVacanciesAlert,
                       blockedProviderAlert,
                       withdrawnByQaVacanciesAlert));
        }
        public void ShouldReturnFormattedClosedVacancies()
        {
            var vacancies = GetVacancies();

            var sut = new AlertViewModelService();

            var vm = sut.GetBlockedProviderVacanciesAlert(vacancies, null);

            vm.ClosedVacancies.Count.Should().Be(5);
            vm.ClosedVacancies[0].Should().Be("A vacancy (VAC55555555)");
            vm.ClosedVacancies[1].Should().Be("B vacancy (VAC11111111)");
            vm.ClosedVacancies[2].Should().Be("C vacancy (VAC44444444)");
            vm.ClosedVacancies[3].Should().Be("D vacancy (VAC22222222)");
            vm.ClosedVacancies[4].Should().Be("E vacancy (VAC33333333)");
        }
        public void ShouldReturnNonDismissedVacancies(string userLastDismissedDateString, int?expectedNumberOfVacanciesReturned)
        {
            var vacancies = GetVacancies();

            var userLastDismissedDate = GetUserDismissedDate(userLastDismissedDateString);

            var sut = new AlertViewModelService();

            var vm = sut.GetBlockedProviderVacanciesAlert(vacancies, userLastDismissedDate);

            if (expectedNumberOfVacanciesReturned == null)
            {
                vm.Should().BeNull();
            }
            else
            {
                vm.ClosedVacancies.Count.Should().Be(expectedNumberOfVacanciesReturned);
            }
        }