Ejemplo n.º 1
0
        [Test] // 4
        public void DeleteBankAccount_AfterAddingANewBankAccountToTheContext_DeletesTheNewAddedBankAccountFromTheContextAndLeavesAnEmptyTableOfBankAccountsInContext_WhenCalledWithTheAddedBankAccount()
        {
            //Arrange
            BankAccountRepository bankAccountRepository = new BankAccountRepository(context);
            BankAccountType       bankAccountType1      = new BankAccountType {
                BankAccountTypeId = 1, BankAccountTypeName = "Saving Account"
            };

            context.BankAccountTypes.Add(bankAccountType1);
            BankAccount bankAccount = new BankAccount {
                CustomerId = 1, BankAccountTypeId = 1, Interestrate = 0
            };

            context.BankAccounts.Add(bankAccount);
            context.SaveChanges();
            List <BankAccount> expected = new List <BankAccount>();

            //Act
            bankAccountRepository.DeleteBankAccount(bankAccount);
            context.SaveChanges();
            var actual = context.BankAccounts.ToList();

            //Assert
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 2
0
        public void DeleteBankAccountSuccessfully()
        {
            var content = File.ReadAllText("../../../Fixtures/bank_account_delete.json");

            var client = GetMockClient(content);
            var repo   = new BankAccountRepository(client.Object);

            var result = repo.DeleteBankAccount("e923013e-61e9-4264-9622-83384e13d2b9");

            client.VerifyAll();
            Assert.IsTrue(result);
        }
Ejemplo n.º 3
0
 public bool DeleteBankAccount(long bankAccountId)
 {
     try
     {
         return(_bankAccountRepository.DeleteBankAccount(bankAccountId));
     }
     catch (Exception ex)
     {
         ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message);
         return(false);
     }
 }
Ejemplo n.º 4
0
 //4 Delete a Bank Account
 public void DeleteBankAccount(BankAccount bankAccountToDelete)
 {
     bankAccountRepository.DeleteBankAccount(bankAccountToDelete);
 }