public void Get_ReturnsCorrectNumberOfServices()
        {
            //Arrange
            products = new List <Product>
            {
                new Product()
                {
                    Name = "First"
                },
                new Product()
                {
                    Name = "Second"
                },
                new Product()
                {
                    Name = "Third"
                },
            };

            _productRepository.Setup(x => x.Get()).Returns(products);

            //Act
            var result = _service.GetProducts();

            //Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(3, result.Count);
        }
        // GET: HOME PAGE FOR CUSTOMER
        public ActionResult Index()
        {
            IEnumerable <ProductModel> productList = null;

            try
            {
                productList = productActionContext.GetProducts();
            }
            catch (Exception e)
            {
                //LOG EXCEPTION
                logger.Error("Product List not loaded by Index() of User Controller : ", e);
            }
            return(View(productList));
        }
Beispiel #3
0
        // GET: api/Product
        public IEnumerable <MProduct> Get()
        {
            ProductActions p1 = new ProductActions();

            return(p1.GetProducts());
        }