예제 #1
0
        public void ConfirmCashWithdrawalTotal()
        {
            //Arrange
            IWalletTransactionComponent bankCard   = WalletTransactionComponentFactory.CreateTransactionComponent(1, WalletItemTypeEnum.BankCard);
            IWalletTransactionComponent passbook   = WalletTransactionComponentFactory.CreateTransactionComponent(2, WalletItemTypeEnum.Passbook);
            IWalletTransactionComponent chequebook = WalletTransactionComponentFactory.CreateTransactionComponent(3, WalletItemTypeEnum.Chequebook);
            IWalletTransactionComponent cash       = WalletTransactionComponentFactory.CreateTransactionComponent(4, WalletItemTypeEnum.Cash);

            IWalletState actual = WalletStateFactory.CreateWalletState(1, 100, 100, new List <IWalletTransactionComponent>()
            {
                bankCard, passbook, chequebook, cash
            });

            //Act
            actual.WalletTransactions.Where(o => o.WalletItemType == WalletItemTypeEnum.BankCard).SingleOrDefault().Amount   = 100;
            actual.WalletTransactions.Where(o => o.WalletItemType == WalletItemTypeEnum.Passbook).SingleOrDefault().Amount   = 100;
            actual.WalletTransactions.Where(o => o.WalletItemType == WalletItemTypeEnum.Chequebook).SingleOrDefault().Amount = 100;
            actual.WalletTransactions.Where(o => o.WalletItemType == WalletItemTypeEnum.Cash).SingleOrDefault().Amount       = 100;
            //Assert
            Assert.AreEqual(actual.CashWithdrawals, 100m);
        }
예제 #2
0
        public void ConfirmCashUnder()
        {
            //Arrange
            IWalletTransactionComponent bankCard   = WalletTransactionComponentFactory.CreateTransactionComponent(1, WalletItemTypeEnum.BankCard);
            IWalletTransactionComponent passbook   = WalletTransactionComponentFactory.CreateTransactionComponent(2, WalletItemTypeEnum.Passbook);
            IWalletTransactionComponent chequebook = WalletTransactionComponentFactory.CreateTransactionComponent(3, WalletItemTypeEnum.Chequebook);
            IWalletTransactionComponent cash       = WalletTransactionComponentFactory.CreateTransactionComponent(4, WalletItemTypeEnum.Cash);

            ((WalletReceiptableTransactionComponent)cash).Receipts.Add(new CashReceipt(500));

            IWalletState actual = WalletStateFactory.CreateWalletState(1, 100, 100, new List <IWalletTransactionComponent>()
            {
                bankCard, passbook, chequebook, cash
            });

            //Act
            actual.WalletTransactions.Where(o => o.WalletItemType == WalletItemTypeEnum.BankCard).SingleOrDefault().Amount   = 100;
            actual.WalletTransactions.Where(o => o.WalletItemType == WalletItemTypeEnum.Passbook).SingleOrDefault().Amount   = 100;
            actual.WalletTransactions.Where(o => o.WalletItemType == WalletItemTypeEnum.Chequebook).SingleOrDefault().Amount = 100;
            actual.WalletTransactions.Where(o => o.WalletItemType == WalletItemTypeEnum.Cash).SingleOrDefault().Amount       = 100;
            //Assert
            Assert.AreEqual(actual.CashDiscrepancy, -100m);
        }