public void UT_Portal_categories() { var repo = new mockPortalRepository(); var service = new PortalCategoriesV1(repo); var resp = service.Exec(null, 0, 10); if (resp.list.Count != 1) { Assert.Fail("categories // fail 1"); } if (resp.total != 1) { Assert.Fail("categories // fail 2"); } if (resp.list[0].Id != 1) { Assert.Fail("categories // fail 3.1"); } if (resp.list[0].Name != "teste") { Assert.Fail("categories // fail 3.2"); } }
public ActionResult <string> PortalCategories(int skip, int take) { try { using (var db = new SqlConnection(GetDBConnectionString())) { var service = new PortalCategoriesV1(portalRepository); var resp = service.Exec(db, skip, take); return(Ok(JsonConvert.SerializeObject(resp))); } } catch (System.Exception ex) { return(BadRequest(new ServiceError { DebugInfo = ex.ToString(), Message = _defaultError })); } }