public void TransferMoneyDestinationAccountNotFound( )
        {
            TransferController controller = new TransferController( new FakeAccountRepository( ) );

            TransferMoneyViewModel model = new TransferMoneyViewModel
            {
                OriginAccountId = 1,
                DestinationAccountId = 2000,
                AmmountToTransfer = 100
            };

            ViewResult result = controller.TransferMoney( model ) as ViewResult;

            Assert.AreEqual( "La cuenta de destino no existe", result.ViewBag.Result );
        }
        public void TransferMoneyOk( )
        {
            TransferController controller = new TransferController( new FakeAccountRepository( ) );

            TransferMoneyViewModel model = new TransferMoneyViewModel
                                            {
                                                OriginAccountId = 1,
                                                DestinationAccountId = 2,
                                                AmmountToTransfer = 100
                                            };
 
            ViewResult result = controller.TransferMoney( model ) as ViewResult;

            Assert.AreEqual( "Transferencia exitosa", result.ViewBag.Result );
        }
        public void TransferMoneyOk2( )
        {
            Mock<IAccountRepository> mockRepository = new Mock<IAccountRepository>( );

            mockRepository.Setup( m => m.Get( 1 ) ).Returns( new Account( ) { Id = 1, Balance = 100 } );
            mockRepository.Setup( m => m.Get( 2 ) ).Returns( new Account( ) { Id = 2, Balance = 500 } );

            TransferController controller = new TransferController( mockRepository.Object );

            TransferMoneyViewModel model = new TransferMoneyViewModel
            {
                OriginAccountId = 1,
                DestinationAccountId = 2,
                AmmountToTransfer = 100
            };

            ViewResult result = controller.TransferMoney( model ) as ViewResult;

            Assert.AreEqual( "Transferencia exitosa", result.ViewBag.Result );
        }
        public void TransferMoneyInsufficientsFunds( )
        {
            TransferController controller = new TransferController( new FakeAccountRepository( ) );

            TransferMoneyViewModel model = new TransferMoneyViewModel
            {
                OriginAccountId = 1,
                DestinationAccountId = 2,
                AmmountToTransfer = 10000
            };

            ViewResult result = controller.TransferMoney( model ) as ViewResult;

            Assert.AreEqual( "La cuenta de origen no tiene fondos suficientes", result.ViewBag.Result );
        }