Exemple #1
0
        public void GetAll_Test()
        {
            db.Setup(x => x.Items.GetAll()).Returns(GetAll());

            List <Goods> act = mapper.Map <List <Goods> > (service.GetAll());
            var          exp = GetAll();

            Assert.NotNull(act);
            Assert.AreEqual(exp [0].GoodsId, act [0].GoodsId);
            Assert.AreEqual(exp [0].Name, act [0].Name);
            Assert.AreEqual(exp [1].Price, act [1].Price);
            Assert.AreEqual(exp [1].Type.TypeOfGoodsId, act [1].Type.TypeOfGoodsId);
        }
Exemple #2
0
        public IHttpActionResult GetAll()
        {
            var goods = services.GetAll();

            if (goods.Count() == 0)
            {
                return(NotFound());
            }

            var _goods = mapper.Map <IEnumerable <Goods> > (goods);

            return(Ok(_goods));
        }