public void EventBindTest() { var c = new EventStub(); SRM["c"] = c; SRM.Run(@" var t = debug.assert; t( c.DummyEvent, null ); var a = 10; c.DummyEvent = function() { a = 20; }; debug.assertTrue( c.DummyEvent != null, 'event not be attached' ); "); c.RaiseEvent(); SRM.Run(@" t( a, 20 ); t( c.DummyEvent != null ); c.DummyEvent = null; debug.assertTrue( c.DummyEvent == null, 'event not be detached.' ); "); }
public void ImportType() { SRM.ImportType(typeof(Contact)); string script = @" var t = debug.assert; var contact = new Contact(); contact.name = 'reo'; t( contact.phoneNumbers != null ); contact.phoneNumbers.add('01-234-567'); t( contact.name, 'reo' ); t( contact.phoneNumbers.length, 1 ); t( contact.phoneNumbers[0], '01-234-567' ); // access invisible property contact.remark = 'comment'; t( contact.remark, null ); "; SRM.Run(script); }
public SRMModel(SRM srm, IMessage msg) { this.srm = srm; conf = new EMConf(); conf.StopCond = StopCondition.PARAMETER; status = ModelStatus.NotIntialized; }
public void AccessProperty() { // import using alias SRM.ImportType(typeof(Friut), "MyClass"); SRM.Run(@" var t = debug.assert; var apple = new MyClass(); apple.name = 'apple'; t(apple.name, 'apple'); apple.Color = 'red'; apple.Price = 1.95; t(apple.color, 'red'); t(apple.price, 1.95); t(apple.color + ' ' + apple.price, 'red 1.95'); t( apple['name'], 'apple' ); t( apple['Color'], 'red' ); t( apple['color'], 'red' ); t( apple['price'], '1.95' ); "); }
public void CLRArrayIndexNumber() { int[] arr = new int[10]; for (int i = 0; i < arr.Length; i++) { arr[i] = i; } SRM["arr"] = arr; SRM.Run(@" debug.assert(arr.length, 10); for(var i=0;i<arr.length;i++) { debug.assert( arr[i], i ); }"); SRM["myarr"] = new MyArrayStub(); SRM.Run(@" debug.assert(myarr.length, 10); for(var i=0;i<myarr.length;i++) { myarr[i] = i; debug.assert( myarr[i], i ); }"); }
public List <SRM> BuscarLista(string palabra) { var ServicioYouTube = new YouTubeService(new BaseClientService.Initializer() { ApiKey = "AIzaSyCENuuzGXhwKTvQVsuG0HyhEYW9DWuXGPg", ApplicationName = this.GetType().ToString() }); var BuscarListaSolicitud = ServicioYouTube.Search.List("snippet"); BuscarListaSolicitud.Q = palabra; //Buscador BuscarListaSolicitud.MaxResults = 5; SearchListResponse BuscarListaRespuesta = BuscarListaSolicitud.Execute(); IList <Google.Apis.YouTube.v3.Data.SearchResult> searchResults = BuscarListaRespuesta.Items; List <SRM> searchResultModifieds = new List <SRM>(); foreach (var item in searchResults) { SRM searchResultC = new SRM(); searchResultC.VideoId = item.Id.VideoId; searchResultC.ImageUrl = item.Snippet.Thumbnails.Default__.Url; searchResultC.Title = item.Snippet.Title; searchResultC.Title = item.Snippet.ChannelTitle; searchResultC.Expo = "Hello"; searchResultModifieds.Add(searchResultC); } //return searchResults.ToList(); return(searchResultModifieds); }
// // POST: /SRM/Edit/5 public ActionResult Edit(SRM srm) { string strResult = string.Empty; bool bResult = SRMService.Save(srm); string msg = bResult ? "修改成功" : "修改失败"; return(Json(JsonMessageHelper.getJsonMessage(bResult, msg, strResult), "text", JsonRequestBehavior.AllowGet)); }
public ActionResult Create(SRM srm) { string strResult = string.Empty; bool bResult = SRMService.Add(srm); string msg = bResult ? "新增成功" : "新增失败"; return(Json(JsonMessageHelper.getJsonMessage(bResult, msg, null), "text", JsonRequestBehavior.AllowGet)); }
public void IDictionaryEnumeration() { // import using alias SRM["obj"] = new Stuff(); SRM.Run(@" "); }
[TestCase(Disabled = true)] // Not Supported Yet public void InnerClasssAccess() { SRM.ImportType(typeof(StaticA.StaticB)); SRM.Run(@" debug.assert( Test.StaticA.StaticB != null ); debug.assert( new StaticB() != null ); "); }
public void FuncCall() { SRM["myfunc"] = (System.Func <int, int, int>)((a, b) => { return(a + b); }); SRM.Run(@"debug.assert( myfunc(1, 2), 3 );"); }
void DictionaryAccess() { Dictionary <string, object> dic = new Dictionary <string, object>(); dic["name"] = "hello"; SRM["myobj"] = dic; SRM.Run(@" debug.assert( myobj.name, 'hello' ); "); }
public void StaticMemberModify() { SRM.ImportType(typeof(StaticClassTest)); SRM.Run(@" debug.assert( StaticClassTest != null ); debug.assert( StaticClassTest.a, 10 ); StaticClassTest.a = 20; debug.assert( StaticClassTest.a, 20 ); "); }
public void ImportNamespace() { SRM.ImportNamespace("System.Windows.Forms"); SRM.ImportNamespace("System.Drawing"); SRM.Run(@" var t = debug.assert; t( Color != null ); t( Color.Red != null ); "); }
public void StaticMemberAccess() { SRM.ImportType(typeof(System.Drawing.Color)); SRM.Run(@" debug.assert(Color.Yellow, 'Color [Yellow]'); debug.assert(System.Drawing.SystemColors.Control != null); debug.assert(Color.Yellow, System.Drawing.Color.Yellow); "); }
public void CLRArrayPrototype() { int[] arr = { 1, 2, 3, 4, 5 }; SRM["arr"] = arr; SRM.Run(@" var t = debug.assert; t( arr[0], 1 ); t( arr.length, 5 ); t( arr.join('.'), '1.2.3.4.5' ); "); }
public void ImportAndCreate() { SRM.ImportType(typeof(Friut)); SRM.Run(@" var t = debug.assert; var apple = new Friut(); t(typeof apple, 'native object'); t(apple instanceof Friut); "); }
public void AccessLowercaseMethod() { // import using alias SRM.ImportType(typeof(Friut), "MyClass"); SRM.Run(@" var t = debug.assert; var apple = new MyClass(); var c = apple.methodInLowercase(5, 6); t(c, 11); "); }
public void CLRArrayIndexString() { SRM["myarr"] = new MyArrayStub(); SRM.Run(@" for(var i=0;i<myarr.length;i++) { myarr['item'+i] = i; debug.assert( myarr['item'+i], i ); }"); SRM["mylist"] = new MyListStub(); SRM.Run(@" for(var i=0;i<mylist.length;i++) { mylist['item' + i] = i; debug.assert( mylist['item'+ i], i ); }"); }
public void ImportAndCreate2() { // import using alias SRM.ImportType(typeof(Friut), "MyClass"); SRM.Run(@" var t = debug.assert; var apple = new MyClass(); t(typeof apple, 'native object'); t(apple instanceof MyClass); "); }
public void AccessMethod() { // import using alias SRM.ImportType(typeof(Friut), "MyClass"); SRM.Run(@" var t = debug.assert; var apple = new MyClass(); apple.shipOut(); t(apple.isShippedOut, true); "); }
// // GET: /SRM/Details/ public ActionResult Details(int page, int rows, FormCollection collection) { SRM srm = new SRM(); srm.SRMName = collection["SRMName"] ?? ""; srm.OPCServiceName = collection["OPCServiceName"] ?? ""; srm.GetRequest = collection["GetRequest"] ?? ""; srm.GetAllow = collection["GetAllow"] ?? ""; srm.GetComplete = collection["GetComplete"] ?? ""; srm.PutRequest = collection["PutRequest"] ?? ""; srm.PutAllow = collection["PutAllow"] ?? ""; srm.PutComplete = collection["PutComplete"] ?? ""; srm.State = collection["State"] ?? ""; var srmDetail = SRMService.GetDetails(page, rows, srm); return(Json(srmDetail, "text", JsonRequestBehavior.AllowGet)); }
public void NewKeyword() { SRM.ImportType(typeof(ArrayList)); SRM.Run(@" var arr1 = new ArrayList(); debug.assert( arr1 != null ); var arr2 = new ArrayList; debug.assert( arr2 != null ); var alias = ArrayList; debug.assert( new alias() != null ); debug.assert( new alias != null ); "); }
public void IDictionarySupport() { // import using alias SRM["obj"] = new Stuff(); SRM.Run(@" var t = debug.assert; var date = new Date(); obj.name = 'red alert'; obj.startTime = date; t(obj.name, 'red alert'); t(obj.startTime, date); "); }
public void ExtendedObjectValue() { var extObj = new MyObjectValue(); SRM["extObj"] = extObj; SRM.Run("extObj.testProp = 'a';"); TestCaseAssertion.AssertTrue(extObj.ValueSetted); // true TestCaseAssertion.AssertTrue(!extObj.ValueGetted); // false SRM.Run("var a = extObj.testProp;"); TestCaseAssertion.AssertTrue(extObj.ValueSetted); // true TestCaseAssertion.AssertTrue(extObj.ValueGetted); // true extObj = new MyObjectValue(); //SRM.Run("extObj.testProp = 'a';"); TestCaseAssertion.AssertTrue(!extObj.ValueSetted); // true TestCaseAssertion.AssertTrue(!extObj.ValueGetted); // false }
public void FieldAndEventMember() { SRM["c"] = new Contact(); SRM.Run(@" var t = debug.assert; c.fieldMember = 10; t( c.fieldMember, 10 ); c.eventMember = function(){ this.fieldMember = 20; }; "); ((Contact)SRM["c"]).RaiseEventMember(); SRM.Run(@" var t = debug.assert; t( c.fieldMember, 20 ); c.eventMember = null; // remove event c.fieldMember = 10; "); ((Contact)SRM["c"]).RaiseEventMember(); SRM.Run(@" var t = debug.assert; t( c.fieldMember, 10 ); "); }
// /SRM/CreateExcelToClient/ public FileStreamResult CreateExcelToClient() { int page = 0, rows = 0; //int id=0;// =Convert .ToInt32( Request.QueryString["id"]); //if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") //{ // id = Convert.ToInt32(Request.QueryString["id"]); //} int SRMID = Convert.ToInt32(Request.QueryString["ID"]); string SRMName = Request.QueryString["SRMName"]; string OPCServiceName = Request.QueryString["OPCServiceName"]; string GetRequest = Request.QueryString["GetRequest"]; string GetAllow = Request.QueryString["GetAllow"]; string GetComplete = Request.QueryString["GetComplete"]; string PutRequest = Request.QueryString["PutRequest"]; string PutAllow = Request.QueryString["PutAllow"]; string PutComplete = Request.QueryString["PutComplete"]; string Description = Request.QueryString["Description"]; string State = Request.QueryString["State"]; SRM srm = new SRM(); srm.ID = SRMID; srm.SRMName = SRMName; srm.OPCServiceName = OPCServiceName; srm.GetRequest = GetRequest; srm.GetAllow = GetAllow; srm.GetComplete = GetComplete; srm.PutRequest = PutRequest; srm.PutAllow = PutAllow; srm.PutComplete = PutComplete; srm.Description = Description; srm.State = State; ExportParam ep = new ExportParam(); ep.DT1 = SRMService.GetSRM(page, rows, srm); ep.HeadTitle1 = "堆垛机信息"; return(PrintService.Print(ep)); }
public void EventTest() { SRM["c"] = new Contact(); SRM.Run(@" var t = debug.assert; t( c.EventMember, null ); var a = 10; c.EventMember = function() { a = 20; }; t( c.EventMember != null ); "); ((Contact)SRM["c"]).RaiseEventMember(); SRM.Run(@" t( a, 20 ); t( c.EventMember != null ); c.EventMember = null; t( c.EventMember, null ); "); }
public void IDictionaryEnumeration() { // import using alias SRM["obj"] = new Stuff(); SRM.Run(@" var t = debug.assert; var date = new Date(); obj.name = 'red alert'; obj.startTime = date; var o = ''; for(name in obj) { o+=name + ' '; } t(o, 'name startTime '); "); }
public void ComparingOperators() { // import using alias SRM.ImportType(typeof(Friut), "MyClass"); SRM.Run(@" var t = debug.assert; var apple = new MyClass(); apple.price = 1.95; t(apple.price <= 1.95); t(apple.price >= 1.95); t(apple.price == 1.95); t(apple.price == '1.95'); // compare to string t(apple.price === 1.95); apple.price = 2.1; t(apple.price === 2.1); "); }