public void UnitTest_FakeItEasy_Concrete()
        {
            var mockBankAccount = A.Fake<BankAccount>();
            var mockView = A.Fake<IView>();
            var presenter = new CustomerPresenter(mockView, mockBankAccount);

            A.CallTo(() => mockBankAccount.Credit(10)).Returns(100);
            var result = presenter.CreditCustomerAccount(10);

            Assert.AreEqual(100, result);
            Assert.IsTrue(typeof(IBankAccount).IsInstanceOfType(mockBankAccount));
        }
        public void UnitTest_Moq()
        {
            var mockBankAccount = new Moq.Mock<IBankAccount>();
            var mockView = new Moq.Mock<IView>();

            mockBankAccount.Setup(e => e.Debit(10))
                .Returns(100);

            var presenter = new CustomerPresenter(mockView.Object, mockBankAccount.Object);
            var result = presenter.DebitCustomerAccount(10);

            Assert.AreEqual(100, result);
            Assert.IsTrue(typeof(IBankAccount).IsInstanceOfType(mockBankAccount.Object));
        }
        public void UnitTest_NSubstitute_Concrete()
        {
            var mockBankAccount = Substitute.For<BankAccount>();
            var mockView = Substitute.For<IView>();
            var presenter = new CustomerPresenter(mockView, mockBankAccount);

            mockBankAccount.Credit(10).Returns(100);
            var result = presenter.CreditCustomerAccount(10);

            Assert.AreEqual(100, result);
            Assert.IsTrue(typeof(IBankAccount).IsInstanceOfType(mockBankAccount));
        }
        public void UnitTest_NMock3_Concrete()
        {
            _factory = new NMock.MockFactory();
            var mockBankAccount = _factory.CreateMock<BankAccount>();
            var mockView = _factory.CreateMock<IView>();

            //nie da sie bo prywatna
            //mockBankAccount.Expects.One.MethodWith(_ => _.Credit(10))
            //    .WillReturn(100);

            mockBankAccount.Expects.One.MethodWith(_ => _.Credit(10))
                .WillReturn(100);

            var presenter = new CustomerPresenter(mockView.MockObject, mockBankAccount.MockObject);
            var result = presenter.CreditCustomerAccount(10);

            Assert.AreEqual(100, result);
            Assert.IsTrue(typeof(IBankAccount).IsInstanceOfType(mockBankAccount.MockObject));
        }