public void Mortgages_Get_All()
        {
            //Arrange
            _mortgageServiceMock.Setup(x => x.GetAllMortgages()).Returns(_listMortgages);
            var result = ((_objController.Index() as ViewResult).Model) as List <Mortgage>;

            Assert.AreEqual(result.Count, 2);
        }
        public void Mortgage_Index_ShouldPassAllMortgagesToTheView()
        {
            var mortgages = new List <Mortgage> {
                new Mortgage {
                    MortgageId = 1
                },
                new Mortgage {
                    MortgageId = 2
                }
            };

            mockRepositoryMortgage = new Mock <IRepositoryBase <Mortgage> >();
            mockRepositoryMortgage.Setup(m => m.GetAll()).Returns(mortgages.AsEnumerable);

            MortgageController controller = new MortgageController(mockRepositoryMortgage.Object);

            ViewResult             result     = controller.Index() as ViewResult;
            IEnumerable <Mortgage> emortgages = (IEnumerable <Mortgage>)result.ViewData.Model;

            Assert.IsNotNull(result);
            Assert.IsNotNull(emortgages);
            Assert.AreEqual(2, emortgages.Count());
            Assert.AreEqual(mortgages, emortgages);
        }