[Test] // 2 public void Deposit_ThrowsInvalidDepositAmountDeposits_WhenCalledWithANegativeDepositAmountOfMinus100() { //Arrange BankAccount bankAccount = new BankAccount { CustomerId = 1, BankAccountTypeId = 1, Interestrate = 0 }; BankAccountType bankAccountType1 = new BankAccountType { BankAccountTypeId = 1, BankAccountTypeName = "Saving Account" }; context.BankAccountTypes.Add(bankAccountType1); context.BankAccounts.Add(bankAccount); context.SaveChanges(); Depositing depositing = new Depositing(context); //var expected = "Invalid deposit amount"; //Act var ex = Assert.Throws <Exception>(() => depositing.Deposit(-100, bankAccount)); //Assert Assert.That(ex.Message, Is.EqualTo("Invalid deposit amount")); }
public override void SearchReferences() { if (seachingMines == null) { seachingMines = GetComponent <SearchingMine>(); } if (mining == null) { mining = GetComponent <Mining>(); } if (depositing == null) { depositing = GetComponent <Depositing>(); } if (moving == null) { moving = GetComponent <Moving>(); } if (characterController == null) { characterController = GetComponent <CharacterController>(); } }
[Test] // 1 public void Deposit_Deposits100IntoNewCreatedBankAccountIncontextAnd_NewBankAccountInContextHasBalance100_WhenCalled() { //Arrange BankAccount bankAccount = new BankAccount { CustomerId = 1, BankAccountTypeId = 1, Interestrate = 0 }; BankAccountType bankAccountType1 = new BankAccountType { BankAccountTypeId = 1, BankAccountTypeName = "Saving Account" }; context.BankAccountTypes.Add(bankAccountType1); context.BankAccounts.Add(bankAccount); context.SaveChanges(); Depositing depositing = new Depositing(context); var expected = 100; //Act depositing.Deposit(100, bankAccount); context.SaveChanges(); var actual = context.BankAccounts.ToList().ElementAt(0).Balance; //Assert Assert.AreEqual(expected, actual); }
public DepositingService() { depositing = new Depositing(); }