public async Task <IActionResult> ChangeWalletPass(ChangeWalletPassVM changeWalletPassVM) { try { await WalletService.ChangePass(changeWalletPassVM.JMBG, changeWalletPassVM.OldPASS, changeWalletPassVM.NewPASS); ModelState.Clear(); ViewData["SuccessMessage"] = "Wallet password successfully changed."; ViewData["Success"] = "True"; return(View()); } catch (Exception ex) { ViewData["ErrorMessage"] = ex.Message; ViewData["Success"] = "False"; return(View()); } }
public async Task SuccessWalletChangePassTest() { try { string jmbg = "2904992785075"; //Arrange var walletService = new WalletService(CoreUnitOfWork, BankRoutingService, FeeService, Configuration); string password = await walletService.CreateWallet(jmbg, "TestIme", "TestPrezime", (short)BankType.FirstBank, "360123456789999874", "1234"); string newPass = "******"; //Act await walletService.ChangePass(jmbg, password, newPass); //Assert Wallet wallet = await CoreUnitOfWork.WalletRepository.GetById(jmbg); Assert.AreEqual(true, wallet.IsPassValid(newPass)); } catch (Exception ex) { Assert.Fail("Unexpected error: " + ex.Message); } }
public async Task FailWalletChangePassTest4() { try { string jmbg = "2904992785075"; //Arrange var walletService = new WalletService(CoreUnitOfWork, BankRoutingService, FeeService, Configuration); string password = await walletService.CreateWallet(jmbg, "TestIme", "TestPrezime", (short)BankType.FirstBank, "360123456789999874", "1234"); string newPass = "******"; //Act //Assert await Assert.ThrowsExceptionAsync <ArgumentNullException>(async() => await walletService.ChangePass(null, password, newPass)); } catch (Exception ex) { Assert.Fail("Unexpected error: " + ex.Message); } }