Beispiel #1
0
        public void SelectAllDataTest()
        {
            Mock <IRepository <country> > mock = new Mock <IRepository <country> >();
            country c = new country
            {
                id         = 1,
                population = 100,
            };

            mock.Setup(m => m.GetAll()).Returns(new List <country>()
            {
                new country {
                    id = 1, population = 100
                },
                new country {
                    id = 2, population = 200
                },
                new country {
                    id = 3, population = 300
                },
            }.AsQueryable());

            ILogic <country> il = new CountryLogic(mock.Object);

            Assert.That(il.GetAll().Sum(x => x.population) == 600);
        }
Beispiel #2
0
        // GET: Countries
        public virtual ActionResult Index()
        {
            var result = CountryLogic.GetAll();

            var viewModel = new IndexViewModel();

            viewModel.Items = Mapper.Map <IEnumerable <IndexItemViewModel> >(result.Value);

            return(View(viewModel));
        }