public void Remove(BankAccount account) { if (account is null) { throw new ArgumentNullException(nameof(account)); } if (!IsExists(account, out int index)) { throw new NotImplementedException($"The {nameof(account)} already exists"); } _bankAccountRepository.Remove(index); }
public void BankAccountRepositoryRemoveItemDeleteIt() { //Arrange var unitOfWork = new MainBcUnitOfWork(); var customerRepository = new CustomerRepository(unitOfWork); var bankAccountRepository = new BankAccountRepository(unitOfWork); var customer = customerRepository.Get(new Guid("43A38AC8-EAA9-4DF0-981F-2685882C7C45")); var bankAccountNumber = new BankAccountNumber("4444", "5555", "3333333333", "02"); var newBankAccount = BankAccountFactory.CreateBankAccount(customer, bankAccountNumber); bankAccountRepository.Add(newBankAccount); unitOfWork.Commit(); //Act bankAccountRepository.Remove(newBankAccount); unitOfWork.Commit(); }
public void BankAccountRepositoryRemoveItemDeleteIt() { //Arrange var unitOfWork = new MainBCUnitOfWork(); IBankAccountRepository bankAccountRepository = new BankAccountRepository(unitOfWork); Guid customerId = new Guid("43A38AC8-EAA9-4DF0-981F-2685882C7C45"); var bankAccountNumber = new BankAccountNumber("4444", "5555", "3333333333", "02"); BankAccount newBankAccount = BankAccountFactory.CreateBankAccount(customerId, bankAccountNumber); newBankAccount.Id = IdentityGenerator.NewSequentialGuid(); bankAccountRepository.Add(newBankAccount); bankAccountRepository.UnitOfWork.Commit(); //Act bankAccountRepository.Remove(newBankAccount); bankAccountRepository.UnitOfWork.Commit(); var result = bankAccountRepository.Get(newBankAccount.Id); //Assert Assert.IsNull(result); }