コード例 #1
0
        [Test] // 3
        public void GetBankAccuntById_WhenAddingANewBankAccount_ReturnsABankAccount_WhenCalledWithBAnkAccountId1()
        {
            //Arrange
            BankAccountRepository bankAccountRepository = new BankAccountRepository(context);
            BankAccountType       bankAccountType1      = new BankAccountType {
                BankAccountTypeId = 1, BankAccountTypeName = "Saving Account"
            };

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

            context.BankAccounts.Add(expected);
            context.SaveChanges();

            //Act
            var actual = bankAccountRepository.GetBankAccuntById(1);

            //Assert
            Assert.AreEqual(expected, actual);
        }
コード例 #2
0
 //3 Get a Bank Account by Id
 public BankAccount GetBankAccuntById(int bankAccountId)
 {
     return(bankAccountRepository.GetBankAccuntById(bankAccountId));
 }