public async Task WalletWithdraw_IncorrectPIN_Fail()
        {
            //Arrange
            WalletService walletService = new WalletService(_coreUnitOfWork,
                                                            new RakicRaiffeisenBrosBankService(),
                                                            new PassService(TestConfigurations.PassMin, TestConfigurations.PassMin),
                                                            TestConfigurations.NumberOfDaysBeforeComission,
                                                            new TransferFactory(TestConfigurations.PercentageComissionStartingAmount,
                                                                                TestConfigurations.FixedComission,
                                                                                TestConfigurations.PercentageComission),
                                                            TestConfigurations.MaxWithdraw, TestConfigurations.MaxDeposit);

            try
            {
                var result = await walletService.Withdraw(
                    "2609992760006", "111111", 1000);

                Assert.Fail("Expected error not thrown");
            }
            catch (RakicRaiffeisenBrosException ex)
            {
                _coreUnitOfWork.ClearTracking();
                var wallet = await walletService.GetWallet("2609992760007", "111111");

                Assert.AreEqual(20000, wallet.Balance, "Balance doesn't match");
            }
            catch (Exception ex)
            {
                Assert.Fail("Unexpected error: " + ex.Message);
            }
        }
Exemplo n.º 2
0
        public async Task Cleanup()
        {
            CoreUnitOfWork.ClearTracking();
            Wallet wallet1 = await CoreUnitOfWork.WalletRepository.GetFirstOrDefaultWithIncludes(
                wallet => wallet.Jmbg == "0605996781029",
                wallet => wallet.Transactions
                );

            if (wallet1 != null)
            {
                await CoreUnitOfWork.WalletRepository.Delete(wallet1);

                await CoreUnitOfWork.SaveChangesAsync();
            }
            CoreUnitOfWork.ClearTracking();

            Wallet wallet2 = await CoreUnitOfWork.WalletRepository.GetFirstOrDefaultWithIncludes(
                wallet => wallet.Jmbg == "0605996781028",
                wallet => wallet.Transactions
                );

            if (wallet2 != null)
            {
                await CoreUnitOfWork.WalletRepository.Delete(wallet2);

                await CoreUnitOfWork.SaveChangesAsync();
            }
            CoreUnitOfWork.ClearTracking();

            Wallet wallet3 = await CoreUnitOfWork.WalletRepository.GetFirstOrDefaultWithIncludes(
                wallet => wallet.Jmbg == "0605996781027",
                wallet => wallet.Transactions
                );

            if (wallet3 != null)
            {
                await CoreUnitOfWork.WalletRepository.Delete(wallet3);

                await CoreUnitOfWork.SaveChangesAsync();
            }
            await DbContext.DisposeAsync();

            DbContext = null;
        }
Exemplo n.º 3
0
        public async Task Cleanup()
        {
            CoreUnitOfWork.ClearTracking();
            Wallet wallet = await CoreUnitOfWork.WalletRepository.GetById("0605996781029");

            if (wallet != null)
            {
                await CoreUnitOfWork.WalletRepository.Delete(wallet);

                await CoreUnitOfWork.SaveChangesAsync();
            }
            await DbContext.DisposeAsync();

            DbContext = null;
        }