public IEnumerable <TestCaseData> HappyPathCaseData() { var dispatcherName = _dispatcher.GetType().Name; foreach (var test in PositiveTests()) { yield return(new TestCaseData(test.Value) .SetName($"{dispatcherName} ITestService.{test.Key}")); } }
// Async implementation /* public void get(string url, IDispatch success, IDispatch failure) */ /* { */ /* var client = new WebClient(); */ /* var task = client.DownloadStringTaskAsync(url); */ /* task.ContinueWith(t => */ /* { */ /* if (t.Exception != null) */ /* { */ /* t.Exception.Handle(e => { */ /* // TODO: send meaningful parameters on failure */ /* applyIDispatch(failure, "TODO"); */ /* return true; */ /* }); */ /* } */ /* else { */ /* applyIDispatch(success, t.Result); */ /* } */ /* }); */ /* } */ // Based on: // http://bytes.com/topic/c-sharp/answers/655563-handling-javascript-functions-closures-passed-into-c-function private void applyIDispatch(IDispatch func, string data) { func.GetType().InvokeMember( "", BindingFlags.InvokeMethod, null, func, new object[] { data }); }
public List <JqueryObject> NextAll() { IDispatch dispatch = InvokeMember <IDispatch>("nextAll"); string name = "length"; int dispId; Guid riid = Guid.Empty; HRESULT res = dispatch.GetDispId(ref riid, name, 1, 0, out dispId); int length = (int)dispatch.GetType().InvokeMember("length", BindingFlags.GetProperty, null, dispatch, null); int length2 = (int)dispatch.GetType().InvokeMember("length", BindingFlags.GetProperty, null, dispatch, null); for (int index = 0; index < length; index++) { IDispatch obj = dispatch.GetType().InvokeMember(index.ToString(), BindingFlags.GetProperty, null, dispatch, null) as IDispatch; } return(null); }
public JqueryObject(IDispatch dispatch) { _dispatch = dispatch; _type = dispatch.GetType(); ITypeInfo type = DispatchUtility.GetType(_dispatch); //Type t = type.GetType(); //Type typaae = Type.GetTypeFromProgID("JScriptTypeLib.JScriptTypeInfo", true); //PropertyInfo[] a = type.GetProperties(); //MethodInfo[] b = type.GetMethods(); //MemberInfo[] c = type.GetMembers(); //EventInfo[] e = type.GetEvents(); }
public T GetValue <T>(String name) { object res = _dispatch.GetType().InvokeMember(name, System.Reflection.BindingFlags.GetProperty, null, _dispatch, null); return(res.Convert <T>()); }