public void IndexShouldRetrivedListItemsFromService()
        {
            var service = new Mock<IShopCatalogService>();
            var shopCatalogController = new ShopCatalogController(service.Object);

            shopCatalogController.Index();

            service.Verify(x => x.ListCatalogItems());
        }
        public void IndexShouldListAllItems()
        {
            var service = new Mock<IShopCatalogService>();
            var catalogItemDtos = new List<CatalogItemDTO>();
            service.Setup(x => x.ListCatalogItems()).Returns(catalogItemDtos);
            var shopCatalogController = new ShopCatalogController(service.Object);

            var viewResult = shopCatalogController.Index();

            var viewModel = viewResult.Model as ShopCatalogViewModel;
            viewModel.CatalogItems.Should().BeEquivalentTo(catalogItemDtos);
        }
Ejemplo n.º 3
0
 public void WhenIVisitTheCatalog()
 {
     var shopCatalogService = new ShopCatalogService(_catalogItemRepository, _catalogItemAssembler);
     var shopCatalogController = new ShopCatalogController(shopCatalogService);
     _shopCatalogViewResult = shopCatalogController.Index();
 }