示例#1
0
 public Category getCategoryid(int cid)
 {
     try
     {
         Category cat = _manager.getCategoryid(cid);
         if (cat != null)
         {
             return(cat);
         }
         else
         {
             return(null);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public async Task TestAddCategory_success(int cid, string cname, string cdetails)
        {
            try
            {
                await _repo.AddCategory(new Category()
                {
                    Cid      = cid,
                    Cname    = cname,
                    Cdetails = cdetails,
                });

                var x = _repo.getCategoryid(cid);
                Assert.NotNull(x);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.InnerException.Message);
            }
        }
        public async Task TestAddCategory_success(int cid, string cname, string cdetails)
        {
            try
            {
                CategoryModel cat = new CategoryModel();
                cat.Cid      = cid;
                cat.Cname    = cname;
                cat.Cdetails = cdetails;

                await _repo.AddCategory(cat);

                var x = _repo.getCategoryid(cid);
                Assert.NotNull(x);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.InnerException.Message);
            }
        }