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