public void TestMethod_17() { Inventor2 tesla = new Inventor2("Nikola Tesla", new DateTime(1856, 7, 9), "Serbian"); DateTime dt = (DateTime)ExpressionEvaluator.GetValue(null, "new DateTime(1974, 8, 24)"); // Register Inventor type then create new inventor instance within Add method inside an expression list. // Then return the new count of the Members collection. TypeRegistry.RegisterType(typeof(PlaceOfBirth)); int three = (int)ExpressionEvaluator.GetValue(tesla.Members, "( Add(new PlaceOfBirth('Aleksandar Seovic')); Count)"); TypeRegistry.RegisterType(typeof(Inventor)); Inventor aleks = (Inventor)ExpressionEvaluator.GetValue(null, "new Inventor('Aleksandar Seovic', date('1974-08-24'), 'Serbian', Inventions = new string[]{'SPELL'})"); }
public void TestMethod_19() { Inventor tesla = new Inventor("Nikola Tesla", new DateTime(1856, 7, 9), "Serbian"); Dictionary<string, object> vars = new Dictionary<string, object>(); vars["newName"] = "Mike Tesla2"; var a = ExpressionEvaluator.GetValue(tesla, "Name = #newName", vars); ExpressionEvaluator.GetValue(tesla, "( #oldName = Name; Name = 'Nikola Tesla' )", vars); String oldName = (String)vars["oldName"]; // Mike Tesla vars["prez"] = "president"; Inventor2 pupin = (Inventor2)ExpressionEvaluator.GetValue(tesla, "Officers[#prez]", vars); }