public void CeneralValue_APIAction_ReturnAPIActionResult_Test() { //Arrange var parameter = new { Operate = "Update", UserID = "mif", UserRole = "Admin", SchoolYear = "20202021", StudentID = "00028123131298", Exceptionality = "110", Placement = "03", Program = "01", }; var sp = "dbo.SIC_sys_StudentSpedProfile"; var expect = "Successfully"; //Act var apiAction = new APIAction <string>(); var result = apiAction.ValueOfT("APIaction", sp, parameter); //Assert Assert.AreEqual(expect, result, $"API Action result testing {result}"); }
public static string getActionString(APIAction action) { switch (action) { case APIAction.ACCOUNT: { return "account"; } case APIAction.MARKETS: { return "currency_markets"; } case APIAction.WALLET: { return "currency_accounts"; } case APIAction.HASH: { return "hash_accounts"; } default: { return ""; } } }
public void CeneralList_GetGenricListByCategory_ReturnListbyCategoryTest() { //Arrange var parameter = new { Operate = "Get", UserID = "mif", UserRole = "Admin", SchoolYear = "20202021", SchoolCode = "0501", Grade = "10", SearchBy = "", SearchValue = "", Scope = "School" }; var sp = "dbo.SIC_sys_ListofStudents"; //Act var apiAction = new APIAction <Student>(); var result = apiAction.ListOfT("StudentList", sp, parameter); // var result = APIListofT<Student>.CeneralList("StudentList", sp, parameter); //Assert Assert.IsNotNull(result, $"Search Student List Testing {result.Count}"); }
public static Tuple <bool, string> Handle(APIAction action, int input) { // Get the Handler var instance = GetHandler <int, string>(action); // Check can execute if (instance == null) { throw new InvalidOperationException(); } return(instance.Handle(input)); }
private static IActionHandler <TInput, TResult> GetHandler <TInput, TResult>(APIAction action) { var handlerType = Assembly .GetExecutingAssembly() .GetTypes() .Where(type => type.IsClass && typeof(IActionHandler <TInput, TResult>).IsAssignableFrom(type)) .FirstOrDefault(type => type.Name.Equals(string.Concat(Enum.GetName(typeof(APIAction), action), "Handler"))); if (handlerType == null) { throw new InvalidOperationException($"Invalid API Action: {Enum.GetName(typeof(APIAction), action)}. No handler found."); } return(Activator.CreateInstance(handlerType) as IActionHandler <TInput, TResult>); }
void ThreadingPolicy.Post(APIAction action) { action(); }
void ThreadingPolicy.Send(APIAction action) { action(); }
public APIMonitoringAttribute(APIAction apiAction) { this.ApiAction = apiAction; }
public ApiConfiguration GetApiConfiguration(APIAction action) { return(this.GetSingleWhere(item => (int)item.ApiAction == (int)action)); }
public static bool CanPerform(APIAction action, string objectType, long objectId, AuthenticationToken user) { // check whether the user is allowed to perform action on a(n) (database) object with Type objectType and Id objectId return(action == APIAction.GET || action == APIAction.NONE || user != null); //for now, anyone "logged in" can do everything }
public string GetAPIURL(APIAction action) { StringBuilder sb = new StringBuilder("https://www.hashnest.com/api/v1/"); string nonce = getNonce(); sb.Append(getActionString(action)); sb.Append("?access_key="); sb.Append(APIKey); sb.Append("&nonce="); sb.Append(nonce.ToString()); sb.Append("&signature="); sb.Append(getSignature(APIKey, APISecret, nonce, Username)); return sb.ToString(); }
private void RaiseAPIAction(string message) => APIAction?.Invoke(this, message);
public static object ProcessGeneric(APIAction action, string path, string body = "", string itemId = "", AuthenticationToken userToken = null) { return(new KeyValuePair <string, string>("result", "Hello, world!")); }
public APICommand(string command, APIAction action) { m_Command = command; m_Action = action; }
public static string ProcessGenericToXML(APIAction action, string path, string body = "", string itemId = "", AuthenticationToken userToken = null) { return("<note><to>Self</to><from>Justin</from><heading>Reminder</heading><body> Don't forget return an actual XML serialization of useful data!</body></note>"); }