コード例 #1
0
 public void Deposit_IntegrationTest()
 {
     //note, this is an integration test
     bankAccount = new EnterpriseBankAccount(new ConsoleLog())
     {
         Balance = 100
     };
     bankAccount.Deposit(100);
     Assert.That(bankAccount.Balance, Is.EqualTo(200));
 }
コード例 #2
0
        public void Deposit_UnitTestWithDynamicFake()
        {
            var log = Null <ILog> .Instance; //creates a fake ILog object.

            bankAccount = new EnterpriseBankAccount(log)
            {
                Balance = 100
            };
            bankAccount.Deposit(100);
            Assert.That(bankAccount.Balance, Is.EqualTo(200));
        }
コード例 #3
0
        public void Deposit_UnitTestWithStub()
        {
            var log = new NullLogWithResult(true); //creates a stub ILog object.

            bankAccount = new EnterpriseBankAccount(log)
            {
                Balance = 100
            };
            bankAccount.Deposit(100);
            Assert.That(bankAccount.Balance, Is.EqualTo(200));
        }
コード例 #4
0
 public void Deposit_UnitTestWithStaticFake()
 {
     // note, this is an unit test with a null pattern
     // this is a unit test because we've isolated the log object into a null class.
     // note, this (the null pattern) isn't scalable
     bankAccount = new EnterpriseBankAccount(new NullLog())
     {
         Balance = 100
     };
     bankAccount.Deposit(100);
     Assert.That(bankAccount.Balance, Is.EqualTo(200));
 }