public void GetAll_Test()
        {
            authService.Add(new User());
            authService.Add(new User());
            authService.Add(new User());
            goodsService.Add(new Goods());
            shopOrderService.Add(new ShopOrder());
            shopOrderService.Add(new ShopOrder());
            typeOfGoodsService.Add(new TypeOfGoods());
            typeOfGoodsService.Add(new TypeOfGoods());
            typeOfGoodsService.Add(new TypeOfGoods());

            var statistic = new StatisticService(authService, goodsService, typeOfGoodsService, shopOrderService).Get();

            Assert.AreEqual(statistic.TotalCountOfGoods, 1);
            Assert.AreEqual(statistic.TotalCountOfGoodsTypes, 3);
            Assert.AreEqual(statistic.TotalCountOfUsers, 3);
            Assert.AreEqual(statistic.TotalCountOfOrders, 2);
        }
Exemple #2
0
 public IHttpActionResult Add([FromBody] AddModel model)
 {
     if (ModelState.IsValid)
     {
         var _type = mapper.Map <TypeOfGoods> (model);
         services.Add(_type);
         return(Ok());
     }
     else
     {
         return(BadRequest(ModelState));
     }
 }
        public void Add_Test()
        {
            service.Add(new TypeOfGoods()
            {
                TypeOfGoodsId = 1, Name = "n1"
            });
            service.Add(new TypeOfGoods()
            {
                TypeOfGoodsId = 2, Name = "n2"
            });
            service.Add(new TypeOfGoods()
            {
                TypeOfGoodsId = 3, Name = "n3"
            });

            var check = service.Get(2);

            Assert.NotNull(check);
            Assert.AreEqual(check.Name, "n2");
        }