Пример #1
0
        public void FromEntityList_should_return_empty_list_when_entity_list_is_null()
        {
            var productList = new ProductListItem().FromEntityList(null);

            Assert.That(productList, Is.Not.Null);
            Assert.That(productList.Any(), Is.False);
        }
Пример #2
0
        public void FromEntityList_should_return_empty_list_when_entity_list_contains_no_entities()
        {
            var productEntityList = new List<Product>();

            var productList = new ProductListItem().FromEntityList(productEntityList);

            Assert.That(productList, Is.Not.Null);
            Assert.That(productList.Any(), Is.False);
        }
Пример #3
0
        public void FromEntityList_should_map_properties_when_entity_list_contains_entities()
        {
            var productEntityList = Fakes.FakeProductList();

            var productList = new ProductListItem().FromEntityList(productEntityList);

            Assert.That(productList, Is.Not.Null);
            Assert.That(productList.Any(), Is.True);
            Assert.That(productList[0].Name, Is.EqualTo(productEntityList.ToList()[0].Name));
        }
Пример #4
0
 public ViewResult List(int page = 0, int perPage = 25, string orderBy = null, string asc = "true")
 {
     Tuple<IEnumerable<Product>, int> result = GetProductList(page, orderBy, asc, perPage);
     var productList = new ProductListItem().FromEntityList(result.Item1);
     var pagingDto = new PagingDTO {TotalItems = result.Item2, CurrentPage = page, PerPage = perPage, TotalPages = GetTotalPages(result.Item2, perPage)};
     ViewBag.Paging = pagingDto;
     return View(productList);
 }