public void UserStatusChangeSuccess() { var candidateId = new Guid(); var candidate = new Candidate { EntityId = candidateId }; var user = new User { Status = UserStatuses.Active, EntityId = candidateId }; var candidateService = new Mock <ICandidateService>(); var userReadRepository = new Mock <IUserReadRepository>(); candidateService .Setup(cs => cs.GetCandidate(candidateId)) .Returns(candidate); userReadRepository.Setup(ur => ur.Get(candidate.EntityId)).Returns(user); candidateService .Setup(cs => cs.SetCandidateDeletionPending(candidate)) .Returns(true); var provider = new AccountProviderBuilder().With(candidateService).Build(); var result = provider.SetUserAccountDeletionPending(candidateId); result.Should().BeTrue(); }
public void MobileVerificationRequiredMarketing(string newPhoneNumber, bool verifiedMobile, bool allowSmsMarketing, string expectedCode) { var candidateId = Guid.NewGuid(); var candidate = new CandidateBuilder(candidateId).PhoneNumber("0123456789").VerifiedMobile(verifiedMobile).Build(); var candidateService = new Mock <ICandidateService>(); candidateService.Setup(cs => cs.GetCandidate(candidateId)).Returns(candidate); var viewModel = new SettingsViewModelBuilder().PhoneNumber(newPhoneNumber).AllowSmsMarketing(allowSmsMarketing).Build(); var accountProvider = new AccountProviderBuilder().With(candidateService).Build(); var mediator = new AccountMediatorBuilder().With(accountProvider).Build(); var result = mediator.SaveSettings(candidateId, viewModel); if (expectedCode == AccountMediatorCodes.Settings.MobileVerificationRequired) { result.AssertMessage(expectedCode, AccountPageMessages.MobileVerificationRequired, UserMessageLevel.Success, true); } else { result.AssertCode(expectedCode); } }
public void MobileVerificationRequiredCommunications(string newPhoneNumber, bool verifiedMobile, bool enableAnyTextCommunication, string expectedCode) { var candidateId = Guid.NewGuid(); var candidate = new CandidateBuilder(candidateId).PhoneNumber("0123456789").VerifiedMobile(verifiedMobile).Build(); var candidateService = new Mock <ICandidateService>(); candidateService.Setup(cs => cs.GetCandidate(candidateId)).Returns(candidate); var viewModel = new SettingsViewModelBuilder().PhoneNumber(newPhoneNumber).EnableAnyTextCommunication(enableAnyTextCommunication).EnableApplicationStatusChangeAlertsViaEmail(true).Build(); var accountProvider = new AccountProviderBuilder().With(candidateService).Build(); var mediator = new AccountMediatorBuilder().With(accountProvider).Build(); var result = mediator.SaveSettings(candidateId, viewModel); if (expectedCode == AccountMediatorCodes.Settings.MobileVerificationRequired) { result.AssertMessage(expectedCode, AccountPageMessages.MobileVerificationRequired, UserMessageLevel.Success, true); } else { result.AssertCodeAndMessage(expectedCode); } }