Exemple #1
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);
        }
Exemple #2
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);
        }
Exemple #3
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);
        }