public void then_canadian_cash_results_in_correct_transaction()
        {
            BankAccount account = new BankAccount(1, AccountType.Savings, 500m);
            account.Deposit(new Currency("CAD", 20.0m));

            DateTime datetime = account.Transactions.Last().DateTime;

            Assert.IsTrue(TranactionEqualityComparer.Instance.Equals(account.Transactions.Last(), new Transaction(datetime, 20m, false)));
        }
 public void SetBankAccount(int id, BankAccount account)
 {
     var cashAsset = GetCashAsset(id);
     if(cashAsset.Account == null)
         cashAsset.SetBankAccount(account);
     else
         cashAsset.UpdateBankAccount(account);
     context.SaveChanges();
 }
 public BankAccountViewModel GetBankAccountViewModel(BankAccount account)
 {
     if (account == null)
     {
         return new BankAccountViewModel { BankId = 0, Number = 0 };
     }
     var bankAccounViewModel = new BankAccountViewModel();
     bankAccounViewModel.BankId = account.Bank.Id;
     bankAccounViewModel.Number = account.Number;
     return bankAccounViewModel;
 }
 public void then_canadian_cash_succeeds()
 {
     BankAccount account = new BankAccount(1, AccountType.Savings, 500m);
     account.Deposit(new Currency("CAD", 20.0m));
 }
Beispiel #5
0
 public void UpdateBankAccount(BankAccount account)
 {
     RemoveBankAccount();
     SetBankAccount(account);
 }
Beispiel #6
0
 public void RemoveBankAccount()
 {
     Account.FriendCashAssetRemoveCashAsset(this);
     Account = null;
     inCash = true;
 }
Beispiel #7
0
 public void SetBankAccount(BankAccount account)
 {
     account.FriendCashAssetAddCashAsset(this);
     Account = account;
     inCash = false;
 }
        public void TellerDepositCanadianCashToActiveAccountSucceeds()
        {
            BankAccount account =
                new BankAccount(1, AccountType.Savings, 500m);

            account.Deposit(new Currency("CAD", 20.0m));
        }
        public void TellerDepositCanadianCashToActiveAccountResultsInCorrectTransaction()
        {
            BankAccount account = new BankAccount(1, AccountType.Savings, 500m);

            account.Deposit(new Currency("CAD", 20.0m));

            DateTime datetime = account.Transactions.Last().DateTime;

            Assert.IsTrue(TranactionEqualityComparer.Instance.Equals(account.Transactions.Last(), new Transaction(datetime, 20m, false)));
        }
 public void SetUp()
 {
     BankAccount = new BankAccount(1, AccountType.Savings, 500m);
 }
Beispiel #11
0
 public void FriendBancAccountRemoveBankAccount(BankAccount account)
 {
     accounts.Remove(account);
 }
Beispiel #12
0
 public void FriendBankAccountAddBankAccount(BankAccount account)
 {
     accounts.Add(account);
 }
Beispiel #13
0
 public void RemoveBankAccount(BankAccount account)
 {
     account.RemoveBankAccount();
 }
Beispiel #14
0
        public void InitializeStorage()
        {
            Bank firstFakeBank = new Bank("ПервыйФэйкБанк");
            BankAccount firstFakeAccount = new BankAccount(firstFakeBank);
            BankAccount secondFakeAccount = new BankAccount(firstFakeBank);
            Bank secondFakeBank = new Bank("ВторойФэйкБанк");
            BankAccount thirdFakeAccount = new BankAccount(secondFakeBank);
            Bank thirdFakeBank = new Bank("ТретийФэйкБанк");
            BankAccount fourthFakeAccount = new BankAccount(thirdFakeBank);
            BankAccount fifthFakeAccount = new BankAccount(thirdFakeBank);
            BankAccount sixthFakeAccount = new BankAccount(thirdFakeBank);
            BankAccount seventhFakeAccount = new BankAccount(thirdFakeBank);

            Banks.Add(firstFakeBank);
            Banks.Add(secondFakeBank);
            Banks.Add(thirdFakeBank);

            CashAsset firstCashAsset = new CashAsset { Name = "Денежные средства", Cost = 103400, Currency = "рубль" };
            CashAsset secondCashAsset = new CashAsset { Name = "Обогащенный уран", Amount = 130, Unit = "тонна", Cost = 15000, Currency = "евро" };
            CashAsset thirdCashAsset = new CashAsset { Name = "Красные мороженки", Amount = 6575, Unit = "штука", Cost = 150, Currency = "рубль" };
            CashAsset fourthCashAsset = new CashAsset { Name = "Денежные средства", Cost = 100400, Currency = "доллар" };
            CashAsset fifthCashAsset = new CashAsset { Name = "Хрюши", Amount = 57234, Unit = "штука", Cost = 345, Currency = "рубль" };
            CashAsset sixthCashAsset = new CashAsset { Name = "Пиратский алкоголь", Amount = 48345, Unit = "литр", Cost = 456367, Currency = "евро" };
            CashAsset seventhCashAsset = new CashAsset { Name = "Денежные средства", Cost = 10101, Currency = "юань" };
            CashAsset eightCashAsset = new CashAsset { Name = "Денежные средства", Cost = 1000, Currency = "рубль" };
            CashAsset ninthCashAsset = new CashAsset { Name = "Хлам", Amount = 3467, Unit = "килограмм", Cost = 1000, Currency = "евро" };
            CashAsset tenthCashAsset = new CashAsset { Name = "Влажные салфетки", Amount = 5678, Unit = "штука", Cost = 1000, Currency = "юань" };

            CashAssets.Add(firstCashAsset);
            CashAssets.Add(secondCashAsset);
            CashAssets.Add(thirdCashAsset);
            CashAssets.Add(fourthCashAsset);
            CashAssets.Add(fifthCashAsset);
            CashAssets.Add(sixthCashAsset);
            CashAssets.Add(seventhCashAsset);
            CashAssets.Add(eightCashAsset);
            CashAssets.Add(ninthCashAsset);
            CashAssets.Add(tenthCashAsset);

            firstCashAsset.SetBankAccount(firstFakeAccount);
            seventhCashAsset.SetBankAccount(secondFakeAccount);
            eightCashAsset.SetBankAccount(secondFakeAccount);
            tenthCashAsset.SetBankAccount(thirdFakeAccount);
            sixthCashAsset.SetBankAccount(thirdFakeAccount);
            ninthCashAsset.SetBankAccount(secondFakeAccount);
            tenthCashAsset.SetBankAccount(seventhFakeAccount);

            NonmonetaryAsset firstNonmonetaryAsset = new NonmonetaryAsset { Name = "Торговое здание", StartBalanceValue = 30000, ResidualBalanceValue = 5000, EstimatedValue = 10000000, Currency = "рубль", Description = "Здание по адресу улица 101010, дом 10100" };
            NonmonetaryAsset secondNonmonetaryAsset = new NonmonetaryAsset { Name = "Катышки", Amount = 345, Unit = "килограмм", StartBalanceValue = 300, ResidualBalanceValue = 50, EstimatedValue = 1000, Currency = "евро", Description = "Обычные катышки с одежды" };
            NonmonetaryAsset thirdNonmonetaryAsset = new NonmonetaryAsset { Name = "Гвозди", Amount = 111, Unit = "Тонна",  StartBalanceValue = 780, ResidualBalanceValue = 123, EstimatedValue = 10345, Currency = "рубль", Description = "Гвозди гвозди гвозди" };
            NonmonetaryAsset fourthNonmonetaryAsset = new NonmonetaryAsset { Name = "Воздух", StartBalanceValue = 30000, ResidualBalanceValue = 5000, EstimatedValue = 10000000, Currency = "рубль", Description = "Чистый воздух" };
            NonmonetaryAsset fifthNonmonetaryAsset = new NonmonetaryAsset { Name = "Торговое здание", StartBalanceValue = 56000, ResidualBalanceValue = 5345, EstimatedValue = 1685733, Currency = "доллар", Description = "Здание по адресу улица бла бла, дом бла" };

            NonmonetaryAssets.Add(firstNonmonetaryAsset);
            NonmonetaryAssets.Add(secondNonmonetaryAsset);
            NonmonetaryAssets.Add(thirdNonmonetaryAsset);
            NonmonetaryAssets.Add(fourthNonmonetaryAsset);
            NonmonetaryAssets.Add(fifthNonmonetaryAsset);

            SaveChanges();
        }