예제 #1
0
        public void ShouldNotAllowLoginIfPendingDeletion()
        {
            // Arrange.
            var candidateId        = Guid.NewGuid();
            var userAccountService = new Mock <IUserAccountService>();

            userAccountService
            .Setup(s => s.GetUser(LoginViewModelBuilder.ValidEmailAddress, false))
            .Returns(new User
            {
                Status = UserStatuses.PendingDeletion
            });

            var provider  = new CandidateServiceProviderBuilder().With(userAccountService).Build();
            var viewModel = new LoginViewModelBuilder().WithValidCredentials().Build();

            // Act.
            var resultViewModel = provider.Login(viewModel);

            /*return new LoginResultViewModel(LoginPageMessages.InvalidUsernameOrPasswordErrorText)
             * {
             *  EmailAddress = model.EmailAddress,
             *  UserStatus = userStatus
             * };*/

            // Assert.
            resultViewModel.ViewModelMessage.Should().Be(LoginPageMessages.InvalidUsernameAndOrPasswordErrorText);
        }
예제 #2
0
        public void ShouldSetPendingUsernameVerificationRequired(string pendingUsername, bool expectedResult)
        {
            // Arrange.
            var candidateId        = Guid.NewGuid();
            var userAccountService = new Mock <IUserAccountService>();

            userAccountService
            .Setup(s => s.GetUser(LoginViewModelBuilder.ValidEmailAddress, false))
            .Returns(new User
            {
                Status          = UserStatuses.Active,
                PendingUsername = pendingUsername
            });

            var candidateService = new Mock <ICandidateService>();

            candidateService
            .Setup(cs => cs.Authenticate(LoginViewModelBuilder.ValidEmailAddress, LoginViewModelBuilder.ValidPassword))
            .Returns(new CandidateBuilder(candidateId).EnableApplicationStatusChangeAlertsViaText(true).Build);

            var provider  = new CandidateServiceProviderBuilder().With(candidateService).With(userAccountService).Build();
            var viewModel = new LoginViewModelBuilder().WithValidCredentials().Build();

            // Act.
            var resultViewModel = provider.Login(viewModel);

            // Assert.
            resultViewModel.PendingUsernameVerificationRequired.Should().Be(expectedResult);
        }
        public void TestSavedSearchMappings(bool alertsEnabled)
        {
            // Arrange.
            var candidateId      = Guid.NewGuid();
            var savedSearchId    = Guid.NewGuid();
            var candidateService = new Mock <ICandidateService>();

            var savedSearch = new Fixture().Build <SavedSearch>()
                              .With(s => s.EntityId, savedSearchId)
                              .With(s => s.AlertsEnabled, alertsEnabled)
                              .With(s => s.Keywords, string.Empty)
                              .With(s => s.ApprenticeshipLevel, "All")
                              .With(s => s.Location, "CV1 2WT")
                              .With(s => s.WithinDistance, 5)
                              .Create();

            candidateService.Setup(cs => cs.DeleteSavedSearch(candidateId, savedSearchId)).Returns(savedSearch);

            var provider = new CandidateServiceProviderBuilder().With(candidateService).Build();

            // Act.
            var viewModel = provider.DeleteSavedSearch(candidateId, savedSearchId);

            // Assert.
            candidateService.Verify(cs => cs.DeleteSavedSearch(candidateId, savedSearchId), Times.Once);

            viewModel.Should().NotBeNull();
            viewModel.Id.Should().Be(savedSearchId);
            viewModel.Name.Should().Be("Within 5 miles of CV1 2WT");
            viewModel.SearchUrl.Should().NotBeNull();
            viewModel.SearchUrl.Value.Should().NotBeNullOrEmpty();
            viewModel.AlertsEnabled.Should().Be(alertsEnabled);
            viewModel.ApprenticeshipLevel.Should().Be("All");
        }
예제 #4
0
        public void ExceptionError()
        {
            var userAccountService = new Mock <IUserAccountService>();

            userAccountService.Setup(cs => cs.ResendAccountUnlockCode(EmailAddress)).Throws <Exception>();
            var provider  = new CandidateServiceProviderBuilder().With(userAccountService).Build();
            var viewModel = new AccountUnlockViewModelBuilder(EmailAddress, AccountUnlockCode).Build();

            var returnedViewModel = provider.RequestAccountUnlockCode(viewModel);

            returnedViewModel.Status.Should().Be(AccountUnlockState.Error);
        }
예제 #5
0
        public void AccountNotFound()
        {
            var userAccountService = new Mock <IUserAccountService>();

            userAccountService.Setup(cs => cs.ResendAccountUnlockCode(EmailAddress)).Throws(new CustomException(Application.Interfaces.Users.ErrorCodes.UnknownUserError));
            var provider  = new CandidateServiceProviderBuilder().With(userAccountService).Build();
            var viewModel = new AccountUnlockViewModelBuilder(EmailAddress, AccountUnlockCode).Build();

            var returnedViewModel = provider.RequestAccountUnlockCode(viewModel);

            returnedViewModel.Status.Should().Be(AccountUnlockState.AccountEmailAddressOrUnlockCodeInvalid);
        }
예제 #6
0
        public void AccountInIncorrectState()
        {
            var userAccountService = new Mock <IUserAccountService>();

            userAccountService.Setup(cs => cs.ResendAccountUnlockCode(EmailAddress)).Throws(new CustomException(ErrorCodes.EntityStateError));
            var provider  = new CandidateServiceProviderBuilder().With(userAccountService).Build();
            var viewModel = new AccountUnlockViewModelBuilder(EmailAddress, AccountUnlockCode).Build();

            var returnedViewModel = provider.RequestAccountUnlockCode(viewModel);

            returnedViewModel.Status.Should().Be(AccountUnlockState.UserInIncorrectState);
        }
        public void GivenEntityStateError_ThenUserInIncorrectStateIsReturned()
        {
            var candidateService = new Mock <ICandidateService>();

            candidateService.Setup(cs => cs.UnlockAccount(EmailAddress, AccountUnlockCode)).Throws(new CustomException(Domain.Entities.ErrorCodes.EntityStateError));
            var provider  = new CandidateServiceProviderBuilder().With(candidateService).Build();
            var viewModel = new AccountUnlockViewModelBuilder(EmailAddress, AccountUnlockCode).Build();

            var returnedViewModel = provider.VerifyAccountUnlockCode(viewModel);

            returnedViewModel.Status.Should().Be(AccountUnlockState.UserInIncorrectState);
        }
        public void Us796_Ac1_DefaultCommunicationPreferences()
        {
            Candidate candidate        = null;
            var       candidateService = new Mock <ICandidateService>();

            candidateService.Setup(cs => cs.Register(It.IsAny <Candidate>(), It.IsAny <string>())).Callback <Candidate, string>((c, s) => { candidate = c; });

            var provider  = new CandidateServiceProviderBuilder().With(candidateService).Build();
            var viewModel = new RegisterViewModelBuilder().Build();

            var registered = provider.Register(viewModel);

            candidate.Should().NotBeNull();
            candidate.CommunicationPreferences.Should().NotBeNull();

            {
                var preferences = candidate.CommunicationPreferences.ApplicationStatusChangePreferences;

                preferences.Should().NotBeNull();
                preferences.EnableEmail.Should().BeTrue();
                preferences.EnableText.Should().BeTrue();
            }

            {
                var preferences = candidate.CommunicationPreferences.ExpiringApplicationPreferences;

                preferences.Should().NotBeNull();
                preferences.EnableEmail.Should().BeTrue();
                preferences.EnableText.Should().BeTrue();
            }

            {
                var preferences = candidate.CommunicationPreferences.MarketingPreferences;

                preferences.Should().NotBeNull();
                preferences.EnableEmail.Should().BeTrue();
                preferences.EnableText.Should().BeTrue();
            }

            {
                var preferences = candidate.CommunicationPreferences.SavedSearchPreferences;

                preferences.Should().NotBeNull();
                preferences.EnableEmail.Should().BeTrue();
                preferences.EnableText.Should().BeFalse();
            }

            candidate.CommunicationPreferences.VerifiedMobile.Should().BeFalse();
            candidate.CommunicationPreferences.MobileVerificationCode.Should().BeNullOrEmpty();

            registered.Should().BeTrue();
        }
        public void AlertsEnabled()
        {
            var         candidateId      = Guid.NewGuid();
            SavedSearch savedSearch      = null;
            var         candidateService = new Mock <ICandidateService>();

            candidateService.Setup(cs => cs.CreateSavedSearch(It.IsAny <SavedSearch>())).Callback <SavedSearch>(ss => { savedSearch = ss; });
            var provider  = new CandidateServiceProviderBuilder().With(candidateService).Build();
            var viewModel = new ApprenticeshipSearchViewModelBuilder().Build();

            provider.CreateSavedSearch(candidateId, viewModel);

            savedSearch.AlertsEnabled.Should().BeTrue();
        }
        public void Success()
        {
            var         candidateId      = Guid.NewGuid();
            SavedSearch savedSearch      = null;
            var         candidateService = new Mock <ICandidateService>();

            candidateService.Setup(cs => cs.CreateSavedSearch(It.IsAny <SavedSearch>())).Callback <SavedSearch>(ss => { savedSearch = ss; });
            var provider  = new CandidateServiceProviderBuilder().With(candidateService).Build();
            var viewModel = new ApprenticeshipSearchViewModelBuilder().Build();

            var response = provider.CreateSavedSearch(candidateId, viewModel);

            response.Should().NotBeNull();
            candidateService.Verify(cs => cs.CreateSavedSearch(It.IsAny <SavedSearch>()), Times.Once);
            savedSearch.Should().NotBeNull();
        }
        public void Error()
        {
            var candidateId      = Guid.NewGuid();
            var candidateService = new Mock <ICandidateService>();

            candidateService.Setup(cs => cs.CreateSavedSearch(It.IsAny <SavedSearch>())).Throws <Exception>();
            var provider  = new CandidateServiceProviderBuilder().With(candidateService).Build();
            var viewModel = new ApprenticeshipSearchViewModelBuilder().Build();

            var response = provider.CreateSavedSearch(candidateId, viewModel);

            response.Should().NotBeNull();
            candidateService.Verify(cs => cs.CreateSavedSearch(It.IsAny <SavedSearch>()), Times.Once);
            response.HasError().Should().BeTrue();
            response.ViewModelMessage.Should().Be(VacancySearchResultsPageMessages.SaveSearchFailed);
        }
예제 #12
0
        public void Us773_DefaultHelpPreferences()
        {
            Candidate candidate        = null;
            var       candidateService = new Mock <ICandidateService>();

            candidateService.Setup(cs => cs.Register(It.IsAny <Candidate>(), It.IsAny <string>())).Callback <Candidate, string>((c, s) => { candidate = c; });
            var provider  = new CandidateServiceProviderBuilder().With(candidateService).Build();
            var viewModel = new RegisterViewModelBuilder().Build();

            var registered = provider.Register(viewModel);

            candidate.Should().NotBeNull();
            candidate.HelpPreferences.Should().NotBeNull();
            candidate.HelpPreferences.ShowSearchTour.Should().BeTrue();
            registered.Should().BeTrue();
        }
예제 #13
0
        public void Us616_Ac7_MobileVerificationRequiredLogin()
        {
            var candidateId        = Guid.NewGuid();
            var userAccountService = new Mock <IUserAccountService>();

            userAccountService.Setup(s => s.GetUserStatus(LoginViewModelBuilder.ValidEmailAddress)).Returns(UserStatuses.Active);
            var candidateService = new Mock <ICandidateService>();

            candidateService.Setup(cs => cs.Authenticate(LoginViewModelBuilder.ValidEmailAddress, LoginViewModelBuilder.ValidPassword)).Returns(new CandidateBuilder(candidateId).AllowMobile(true).VerifiedMobile(false).Build);
            var provider  = new CandidateServiceProviderBuilder().With(candidateService).With(userAccountService).Build();
            var viewModel = new LoginViewModelBuilder().WithValidCredentials().Build();

            var resultViewModel = provider.Login(viewModel);

            resultViewModel.MobileVerificationRequired.Should().BeTrue();
        }
예제 #14
0
        public void Us738_DoesNotAcceptUpdates()
        {
            Candidate candidate        = null;
            var       candidateService = new Mock <ICandidateService>();

            candidateService.Setup(cs => cs.Register(It.IsAny <Candidate>(), It.IsAny <string>())).Callback <Candidate, string>((c, s) => { candidate = c; });
            var provider  = new CandidateServiceProviderBuilder().With(candidateService).Build();
            var viewModel = new RegisterViewModelBuilder().DoesNotAcceptUpdates().Build();

            var registered = provider.Register(viewModel);

            candidate.Should().NotBeNull();
            candidate.CommunicationPreferences.Should().NotBeNull();
            candidate.CommunicationPreferences.AllowEmailMarketing.Should().BeFalse();
            candidate.CommunicationPreferences.AllowMobileMarketing.Should().BeFalse();
            registered.Should().BeTrue();
        }
예제 #15
0
        public void NotSent_NotVerified()
        {
            const string phoneNumber = "0123456789";
            var          viewModel   = new ForgottenEmailViewModel
            {
                PhoneNumber = phoneNumber
            };

            var candidateService = new Mock <ICandidateService>();

            candidateService.Setup(cs => cs.RequestEmailReminder(phoneNumber)).Throws(new CustomException(Domain.Entities.ErrorCodes.EntityStateError));
            var provider = new CandidateServiceProviderBuilder().With(candidateService).Build();

            var sent = provider.RequestEmailReminder(viewModel);

            sent.Should().BeFalse();
        }
예제 #16
0
        public void Sent()
        {
            const string phoneNumber = "0123456789";
            var          viewModel   = new ForgottenEmailViewModel
            {
                PhoneNumber = phoneNumber
            };

            var candidateService = new Mock <ICandidateService>();

            candidateService.Setup(cs => cs.RequestEmailReminder(phoneNumber));
            var provider = new CandidateServiceProviderBuilder().Build();

            var sent = provider.RequestEmailReminder(viewModel);

            sent.Should().BeTrue();
        }
        public void SubCategoriesMustBelongToCategory()
        {
            var          candidateId            = Guid.NewGuid();
            const string category               = "MFP";
            var          subCategories          = new[] { "513", "540", "600" };
            const string subCategoriesFullNames = "Surveying|Construction Civil Engineering";

            var categories = new List <Category>
            {
                new Category(17, category, category, CategoryType.SectorSubjectAreaTier1, CategoryStatus.Active, new List <Category>
                {
                    new Category(255, "513", "Surveying", CategoryType.Framework, CategoryStatus.Active),
                    new Category(273, "540", "Construction Civil Engineering", CategoryType.Framework, CategoryStatus.Active)
                }
                             ),
                new Category(0, "OTHER", "OTHER", CategoryType.SectorSubjectAreaTier1, CategoryStatus.Active, new List <Category>
                {
                    new Category(329, "600", "Should not be included", CategoryType.Framework, CategoryStatus.Active)
                }
                             )
            };

            SavedSearch savedSearch      = null;
            var         candidateService = new Mock <ICandidateService>();

            candidateService.Setup(cs => cs.CreateSavedSearch(It.IsAny <SavedSearch>())).Callback <SavedSearch>(ss => { savedSearch = ss; });
            var provider  = new CandidateServiceProviderBuilder().With(candidateService).Build();
            var viewModel = new ApprenticeshipSearchViewModelBuilder()
                            .WithCategory(category)
                            .WithSubCategories(subCategories)
                            .WithCategories(categories)
                            .Build();

            var response = provider.CreateSavedSearch(candidateId, viewModel);

            response.Should().NotBeNull();
            candidateService.Verify(cs => cs.CreateSavedSearch(It.IsAny <SavedSearch>()), Times.Once);
            savedSearch.Should().NotBeNull();

            savedSearch.CandidateId.Should().Be(candidateId);
            savedSearch.Category.Should().Be(category);
            savedSearch.SubCategories.Length.Should().Be(2);
            savedSearch.SubCategories.Should().NotContain("600");
            savedSearch.SubCategoriesFullName.Should().Be(subCategoriesFullNames);
        }
        public void Success()
        {
            // Arrange.
            var candidateId      = Guid.NewGuid();
            var savedSearchId    = Guid.NewGuid();
            var candidateService = new Mock <ICandidateService>();

            candidateService.Setup(cs => cs.DeleteSavedSearch(candidateId, savedSearchId)).Returns(new SavedSearch());

            var provider = new CandidateServiceProviderBuilder().With(candidateService).Build();

            // Act.
            var response = provider.DeleteSavedSearch(candidateId, savedSearchId);

            // Assert.
            response.Should().NotBeNull();
            candidateService.Verify(cs => cs.DeleteSavedSearch(candidateId, savedSearchId), Times.Once);
        }
예제 #19
0
        public void Us519_Ac1_DefaultMarketingPreferencesEmailOnly()
        {
            Candidate candidate        = null;
            var       candidateService = new Mock <ICandidateService>();

            candidateService.Setup(cs => cs.Register(It.IsAny <Candidate>(), It.IsAny <string>())).Callback <Candidate, string>((c, s) => { candidate = c; });
            var provider  = new CandidateServiceProviderBuilder().With(candidateService).Build();
            var viewModel = new RegisterViewModelBuilder().Build();

            var registered = provider.Register(viewModel);

            candidate.Should().NotBeNull();
            candidate.CommunicationPreferences.Should().NotBeNull();
            candidate.CommunicationPreferences.AllowEmailMarketing.Should().BeTrue();
            candidate.CommunicationPreferences.AllowMobileMarketing.Should().BeFalse();
            candidate.CommunicationPreferences.VerifiedMobile.Should().BeFalse();
            candidate.CommunicationPreferences.MobileVerificationCode.Should().BeNullOrEmpty();
            registered.Should().BeTrue();
        }
        public void Error()
        {
            // Arrange.
            var candidateId      = Guid.NewGuid();
            var savedSearchId    = Guid.NewGuid();
            var candidateService = new Mock <ICandidateService>();

            candidateService.Setup(cs => cs.DeleteSavedSearch(candidateId, savedSearchId)).Throws <Exception>();

            var provider = new CandidateServiceProviderBuilder().With(candidateService).Build();

            // Act.
            var response = provider.DeleteSavedSearch(candidateId, savedSearchId);

            // Assert.
            response.Should().NotBeNull();
            candidateService.Verify(cs => cs.DeleteSavedSearch(candidateId, savedSearchId), Times.Once);
            response.HasError().Should().BeTrue();
            response.ViewModelMessage.Should().Be(AccountPageMessages.DeleteSavedSearchFailed);
        }
        public void CommunicationPreferences()
        {
            var       candidateId      = Guid.NewGuid();
            Candidate candidate        = null;
            var       candidateService = new Mock <ICandidateService>();

            candidateService.Setup(cs => cs.GetCandidate(candidateId)).Returns(new CandidateBuilder(candidateId).EnableSavedSearchAlertsViaEmailAndText(false).Build());
            candidateService.Setup(cs => cs.SaveCandidate(It.IsAny <Candidate>())).Callback <Candidate>(c => { candidate = c; });
            var provider  = new CandidateServiceProviderBuilder().With(candidateService).Build();
            var viewModel = new ApprenticeshipSearchViewModelBuilder().Build();

            provider.CreateSavedSearch(candidateId, viewModel);

            candidateService.Verify(cs => cs.GetCandidate(candidateId), Times.Once);
            candidateService.Verify(cs => cs.SaveCandidate(candidate), Times.Once);

            candidate.Should().NotBeNull();
            candidate.CommunicationPreferences.SavedSearchPreferences.EnableEmail.Should().BeTrue();
            candidate.CommunicationPreferences.SavedSearchPreferences.EnableText.Should().BeFalse();
        }
        public void DuplicatesAreReplaced()
        {
            var candidateId = Guid.NewGuid();
            const ApprenticeshipSearchMode searchMode = ApprenticeshipSearchMode.Category;
            const string keywords               = "chef";
            const string location               = "Warwick";
            const double latitude               = 1.1;
            const double longitude              = 2.1;
            const int    withinDistance         = 15;
            const string apprenticeshipLevel    = "Advanced";
            const string category               = "MFP";
            const string categoryFullName       = "Engineering and Manufacturing Technologies";
            var          subCategories          = new[] { "513", "540" };
            const string subCategoriesFullNames = "Surveying, Construction Civil Engineering";
            const string searchField            = "JobTitle";

            var categories = new List <Category>
            {
                new Category(17, category, categoryFullName, CategoryType.SectorSubjectAreaTier1, CategoryStatus.Active, new List <Category>
                {
                    new Category(255, "513", "Surveying", CategoryType.Framework, CategoryStatus.Active),
                    new Category(273, "540", "Construction Civil Engineering", CategoryType.Framework, CategoryStatus.Active)
                }
                             )
            };

            var existingSavedSearch = new SavedSearchBuilder()
                                      .WithSearchMode(searchMode)
                                      .WithKeywords(keywords)
                                      .WithLocation(location)
                                      .WithLatLong(latitude, longitude)
                                      .WithinDistance(withinDistance)
                                      .WithApprenticeshipLevel(apprenticeshipLevel)
                                      .WithCategory(category)
                                      .WithCategoryFullName(categoryFullName)
                                      .WithSubCategories(subCategories)
                                      .WithSubCategoriesFullNames(subCategoriesFullNames)
                                      .WithSearchField(searchField)
                                      .Build();

            var candidateService = new Mock <ICandidateService>();

            candidateService.Setup(cs => cs.GetSavedSearches(candidateId)).Returns(new List <SavedSearch> {
                existingSavedSearch
            });
            var provider  = new CandidateServiceProviderBuilder().With(candidateService).Build();
            var viewModel = new ApprenticeshipSearchViewModelBuilder()
                            .WithSearchMode(searchMode)
                            .WithKeywords(keywords)
                            .WithLocation(location)
                            .WithLatLong(latitude, longitude)
                            .WithinDistance(withinDistance)
                            .WithApprenticeshipLevel(apprenticeshipLevel)
                            .WithCategory(category)
                            .WithSubCategories(subCategories)
                            .WithSearchField(searchField)
                            .WithCategories(categories)
                            .Build();

            var response = provider.CreateSavedSearch(candidateId, viewModel);

            response.Should().NotBeNull();
            candidateService.Verify(cs => cs.GetSavedSearches(candidateId), Times.Once);

            //Should only replace search if it is new
            candidateService.Verify(cs => cs.CreateSavedSearch(It.IsAny <SavedSearch>()), Times.Never);
        }
        public void Mapping()
        {
            var candidateId = Guid.NewGuid();
            const ApprenticeshipSearchMode searchMode = ApprenticeshipSearchMode.Category;
            const string keywords                   = "chef";
            const string location                   = "Warwick";
            const double latitude                   = 1.1;
            const double longitude                  = 2.1;
            const int    withinDistance             = 15;
            const string apprenticeshipLevel        = "Advanced";
            const string category                   = "MFP";
            const string categoryFullName           = "Engineering and Manufacturing Technologies";
            var          subCategories              = new[] { "513", "540" };
            const string subCategoriesFullNames     = "Surveying|Construction Civil Engineering";
            const string searchField                = "JobTitle";
            const bool   displaySubCategory         = false;
            const bool   displayDescription         = false;
            const bool   displayDistance            = false;
            const bool   displayClosingDate         = false;
            const bool   displayStartDate           = false;
            const bool   displayApprenticeshipLevel = true;
            const bool   displayWage                = true;

            var categories = new List <Category>
            {
                new Category(17, category, categoryFullName, CategoryType.SectorSubjectAreaTier1, CategoryStatus.Active, new List <Category>
                {
                    new Category(255, "513", "Surveying", CategoryType.Framework, CategoryStatus.Active),
                    new Category(273, "540", "Construction Civil Engineering", CategoryType.Framework, CategoryStatus.Active)
                }
                             )
            };

            SavedSearch savedSearch      = null;
            var         candidateService = new Mock <ICandidateService>();

            candidateService.Setup(cs => cs.GetSavedSearches(candidateId)).Returns(new List <SavedSearch> {
                new SavedSearchBuilder().WithLocation("Different Location").Build()
            });
            candidateService.Setup(cs => cs.CreateSavedSearch(It.IsAny <SavedSearch>())).Callback <SavedSearch>(ss => { savedSearch = ss; });
            var provider  = new CandidateServiceProviderBuilder().With(candidateService).Build();
            var viewModel = new ApprenticeshipSearchViewModelBuilder()
                            .WithSearchMode(searchMode)
                            .WithKeywords(keywords)
                            .WithLocation(location)
                            .WithLatLong(latitude, longitude)
                            .WithinDistance(withinDistance)
                            .WithApprenticeshipLevel(apprenticeshipLevel)
                            .WithCategory(category)
                            .WithSubCategories(subCategories)
                            .WithSearchField(searchField)
                            .WithCategories(categories)
                            .WithDisplay(displaySubCategory, displayDescription, displayDistance, displayClosingDate, displayStartDate, displayApprenticeshipLevel, displayWage)
                            .Build();

            var response = provider.CreateSavedSearch(candidateId, viewModel);

            response.Should().NotBeNull();
            candidateService.Verify(cs => cs.CreateSavedSearch(It.IsAny <SavedSearch>()), Times.Once);
            savedSearch.Should().NotBeNull();

            savedSearch.CandidateId.Should().Be(candidateId);
            savedSearch.SearchMode.Should().Be(searchMode);
            savedSearch.Keywords.Should().Be(keywords);
            savedSearch.Location.Should().Be(location);
            savedSearch.Latitude.Should().Be(latitude);
            savedSearch.Longitude.Should().Be(longitude);
            savedSearch.Hash.Should().Be(string.Format("{0}{1}{2}", longitude, latitude, location).GetHashCode());
            savedSearch.WithinDistance.Should().Be(withinDistance);
            savedSearch.ApprenticeshipLevel.Should().Be(apprenticeshipLevel);
            savedSearch.Category.Should().Be(category);
            savedSearch.CategoryFullName.Should().Be(categoryFullName);
            savedSearch.SubCategories.Should().BeEquivalentTo(subCategories);
            savedSearch.SubCategoriesFullName.Should().Be(subCategoriesFullNames);
            savedSearch.SearchField.Should().Be(searchField);
            savedSearch.LastResultsHash.Should().BeNull();
            savedSearch.DateProcessed.Should().Be(null);
            savedSearch.DisplaySubCategory.Should().Be(displaySubCategory);
            savedSearch.DisplayDescription.Should().Be(displayDescription);
            savedSearch.DisplayDistance.Should().Be(displayDistance);
            savedSearch.DisplayClosingDate.Should().Be(displayClosingDate);
            savedSearch.DisplayStartDate.Should().Be(displayStartDate);
            savedSearch.DisplayApprenticeshipLevel.Should().Be(displayApprenticeshipLevel);
            savedSearch.DisplayWage.Should().Be(displayWage);
        }