public static List <T> GetListbyID(string dataSource, string obj, string para) { // var action = (IActionApp<T>)MapClass<T>.DBSource(dataSource); var action = new ActionAppList <T, T>(dataSource); return(action.GetObjList(obj, para)); }
public void Get_GetMenuItems_ReturnMenuItems_Test(string menuType) { // Arrange string uri = "Menu"; var P = new { Operate = menuType, UserID = "mif", UserRole = "Admin", Year = "20202021", Code = "0501", TabID = "10", ObjID = "383823321", AppID = "SIC" }; string qStr = "/" + P.Operate + "/" + P.UserID + "/" + P.UserRole + "/" + P.Year + "/" + P.Code + "/" + P.TabID + "/" + P.ObjID + "/" + P.AppID; string expect = menuType; //Act var apiAction = new ActionAppList <MenuItems, MenuItems>("API"); var list = apiAction.GetObjList(uri, qStr); var result = from s in list where s.MenuID == menuType select s.Name; //Assert //StringAssert.Contains(result.FirstOrDefault(), expect, $" App Role contain {result} "); Assert.IsNotNull(result, $"App List item Testing {list.Count}"); }
private static List <T> RunGetListFromDB(string dataSource, string obj, object parameter) { // var objType = "ActionAppList"; // IActionGet<T> action = (IActionGet<T>)MapClass<T>.ClassType(objType); // var action = (IActionApp<T>)MapClass<T>.ClassType(obj); var action = new ActionAppList <T, T2>(dataSource); return(action.GetObjList(obj, parameter)); }
public IHttpActionResult Get(string SchoolCode, string Searchby, string SearchValue, string Scope) { var action = new ActionAppList <StaffListSearch, StaffList>(); IList <StaffListSearch> result = null; var para = new { Operate = "GetList", UserID = "asm", UserRole = "Admin", SchoolCode, Searchby, SearchValue, Scope }; result = action.GetObjList(para); if (result.Count == 0) { return(NotFound()); } else { return(Ok(result)); } }
public IHttpActionResult Get(string SchoolCode, string AppID) { var action = new ActionAppList <GroupList, UserGroup>(); IList <GroupList> result = null; var para = new { Operate = "GroupList", UserID = "asm", UserRole = "Admin", SchoolCode, AppID }; result = action.GetObjList(para); if (result.Count == 0) { return(NotFound()); } else { return(Ok(result)); } }
public void GetSAP_SearchbyParameter_returnSAPInformation_Test() { string uri = "staff/SAP"; var para = new { SchoolCode = "0354", SchoolYear = "20202021", CPNum = "00050347" }; string qStr = "/" + para.SchoolCode + "/" + para.SchoolYear + "/" + para.CPNum; string expect = "bonavoj"; //Act var iAction = new ActionAppList <StaffList, StaffMemberOf>("API"); // new ActionAppUserGroup()); var list = iAction.GetObjList(uri, qStr); var result = from s in list where s.UserID == expect select s.UserID; //Assert }
public IHttpActionResult GetAPP(string SchoolCode, string SchoolYear, string CPNum) { var _action = new ActionAppList <GroupList, StaffMemberOf>(_dataSource); IList <GroupList> result = null; var para = new { Operate = "APP", UserID = "asm", UserRole = "Admin", SchoolCode, SchoolYear, CPNum }; result = _action.GetObjList(para); if (result.Count == 0) { return(NotFound()); } else { return(Ok(result)); } }
public void Get_GenericListitembyCategory_ReturnListItems_Test() { // Arrange string uri = "ListItems"; string qStr = "/AppRole/tester/admin/1/2/3/4"; string expect = "Principal"; //Act var apiAction = new ActionAppList <NameValueList, NameValueList>("API"); var list = apiAction.GetObjList(uri, qStr); var result = from s in list where s.Value == "Principal" select s.Name; //Assert StringAssert.Contains(result.FirstOrDefault(), expect, $" App Role contain {result} "); // Assert.AreEqual(expect,result, $"App List item Testing {list.Count}"); }
public void GetObjList2_GetAllUserGroupListItmsbyParame_ReturnUserGroupList() { //Arrange var expect = "Grade 05 Work Group"; var para = new { Operate = "GetListbyApp", UserID = "asm", UserRole = "admin", SchoolCode = "0354", AppID = "SIC" }; //Act // DataOperateService<GroupList> dataOperateService = (DataOperateService<GroupList>)MapClass<GroupList>.DBSource("SQL"); var cAction = new ActionAppList<GroupList,UserGroup>(_dataSource); // new ActionAppUserGroup()); //var sp = cAction.GetSPName("Read"); var list = cAction.GetObjList("ClassCall", para); var result = from s in list where s.GroupID == "Grade 05 Work Group" select s.GroupID; //Assert Assert.AreEqual(expect, result.FirstOrDefault(), $" User work Group {list.Count}"); }
public void GetAPP_SearchbyParameter_ReturnUserAppGroupInformation_Test() { // Arrange string uri = "staff/App"; var para = new { SchoolCode = "0354", SchoolYear = "20202021", CPNum = "00050347" }; string qStr = "/" + para.SchoolCode + "/" + para.SchoolYear + "/" + para.CPNum; string expect = "Grade 05 Students"; //Act var iAction = new ActionAppList <GroupList, StaffMemberOf>("API"); // new ActionAppUserGroup()); var list = iAction.GetObjList(uri, qStr); var result = from s in list where s.MemberID == "05" select s.GroupName; //Assert StringAssert.Contains(result.FirstOrDefault(), expect, $" staff Member contain {result} "); }
public void Get_bySearchStaffListbySurName_ReturnStaffListMatccSearchcondition_Test() { // Arrange string uri = "staff/list"; var para = new { SchoolCode = "0354", SearchBy = "SurName", SearchValue = "Pa", Scope = "Board" }; string qStr = "/" + para.SchoolCode + "/" + para.SearchBy + "/" + para.SearchValue + "/" + para.Scope; string expect = "Pa"; //Act var iAction = new ActionAppList <StaffList, StaffList>("API"); // new ActionAppUserGroup()); var list = iAction.GetObjList(uri, qStr); var result = from s in list where s.LastName.Substring(0, 2) == expect select s.LastName; //Assert StringAssert.Contains(result.FirstOrDefault(), expect, $" staff Member contain {result} "); }
public void GetObjList2_GetAllUserGroupListItmsbyAPI_ReturnUserGroupList() { //Arrange var expect = "Grade 05 Work Group"; string uri = "usergroup/list"; string qStr = "/0354/SIC"; //Act // DataOperateService<GroupList> dataOperateService = (DataOperateService<GroupList>)MapClass<GroupList>.DBSource("API"); var cAction = new ActionAppList<GroupList, UserGroup>("API"); // new ActionAppUserGroup()); // var cAction = new ActionAppList<GroupList, UserGroup>(); // new ActionAppUserGroup()); var list = cAction.GetObjList(uri, qStr); var result = from s in list where s.GroupID == "Grade 05 Work Group" select s.GroupID; //Assert Assert.AreEqual(expect, result.FirstOrDefault(), $" User work Group {list.Count}"); }
public void GetSIS_byParameter_ReturnUserClassList_Test() { // Arrange string uri = "staff/SIS"; var para = new { SchoolCode = "0354", SchoolYear = "20212022", CPNum = "00051449" }; string qStr = "/" + para.SchoolCode + "/" + para.SchoolYear + "/" + para.CPNum; string expect = "W04-05/1"; //Act var iAction = new ActionAppList <ClassesList, StaffMemberOf>("API"); // new ActionAppUserGroup()); var list = iAction.GetObjList(uri, qStr); // var list = ManagePageList<ClassesList, StaffMemberOf>.GetList("API", uri, qStr); var result = from s in list where s.ClassCode == expect select s.ClassCode; //Assert StringAssert.Contains(result.FirstOrDefault(), expect, $" staff Member contain {result} "); }
public void GetGroup_SearchbyParameter_ReturnAllGroupListbySchoolandAppID_Test() { // Arrange string uri = "staff/Group"; var para = new { SchoolCode = "0354", AppID = "SIC" }; // var para = new { Operate = "GroupList", UserID = "asm", UserRole = "admin", SchoolCode = "0354", AppID = "SIC" }; string qStr = "/" + para.SchoolCode + "/" + para.AppID; string expect = "Grade 05 Students"; //Act var iAction = new ActionAppList <GroupList, UserGroup>("API"); // new ActionAppUserGroup()); var list = iAction.GetObjList(uri, qStr); var result = from s in list where s.GroupID == "Grade 05 Work Group" select s.GroupName; //Assert StringAssert.Contains(result.FirstOrDefault(), expect, $" staff Member contain {result} "); }