public void Init()
 {
     cat = new ShopModel.Category {
         Name = "test controller category"
     };
     cats = new List <ShopModel.Category>();
     ctrl = new CategoryController();
 }
 public ShopModel.Category TransporterToModel(TCategory t)
 {
     ShopModel.Category category = new ShopModel.Category
     {
         Category_Id = t.id,
         Name        = t.name,
         Timestamp   = t.timestamp
     };
     return(category);
 }
        public TCategory ModelToTransporter(ShopModel.Category t)
        {
            TCategory category = new TCategory
            {
                id        = t.Category_Id,
                name      = t.Name,
                timestamp = t.Timestamp
            };

            return(category);
        }
 public void CategoryCtrlUpdate()
 {
     cats     = ctrl.ReadAll();
     cat      = cats[0];
     cat.Name = "New name";
     Assert.IsTrue(ctrl.Update(cat));
     Assert.IsTrue(ctrl.Read(1).Name == cat.Name);
     cat.Name = "Mouse";
     Assert.IsTrue(ctrl.Update(cat));
     Assert.IsTrue(ctrl.Read(1).Name == "Mouse");
 }
 public void CategoryCtrlDelete()
 {
     cats = ctrl.ReadAll();
     cat  = cats.Find(x => x.Name == cat.Name);
     Assert.IsTrue(ctrl.Delete(cat));
 }