private static void FunctionCall()
        {
            dynamic jsContext   = new DynamicJavascriptContext(new Jurassic.ScriptEngine());

            string script = @"                
                var F2 = function(pInt,pDouble,pString,pBool,pDate) { 

                    var s = ''+pInt+'-'+pDouble+'-'+pString+'-'+pBool+'-'+pDate;
                    console.log(s);
                    return 'F2'; 
                };
            ";
            jsContext.Run(script);
            
            var result = jsContext.Call("F2", 1, 123.456, "hello", true, DateTime.Now);
        }
        static void Main(string[] args) {

            dynamic jsContext   = new DynamicJavascriptContext(new Jurassic.ScriptEngine());

            jsContext.message   = "Hello World !";
            jsContext.number    = 1;
            jsContext.array     = jsContext.Array(1, 2 , 3);
            jsContext.instance  = jsContext.Object( new { b = 2 } );
            jsContext.instance2 = jsContext.Object( new { a = 1, b = 2 } );
                       
            string script = @"
                number           = 123;
                instance['a']    = 1;
                instance['Date'] = new Date();    
                instance2['a']   = 123;
                console.log('Hello log, Date:'+instance['Date']);
                console.log('array.length:'+array.length);
                
                array.push(4);
                for(var i=0; i<array.length; i++)
                    console.log(array[i]);
            ";

            jsContext.Run(script);            

            Console.WriteLine("number: "        + jsContext.number       );
            Console.WriteLine("instance: "      + jsContext.instance     );
            Console.WriteLine("instance.a: "    + jsContext.instance.a   );
            Console.WriteLine("instance.b: "    + jsContext.instance.b   );
            Console.WriteLine("instance.Date: " + jsContext.instance.Date);
            Console.WriteLine("instance2.a: "   + jsContext.instance2.a  );
            Console.WriteLine("array:"          + jsContext.array.Length );
            Console.WriteLine("array[3]:"       + jsContext.array[3]     );

            FunctionCall();
            Console.ReadLine();            
        }
        public void NestedObjects_NestedInputObject_Output() {

            dynamic jsContext = new DynamicJavascriptContext(new Noesis.Javascript.JavascriptContext());                        

            jsContext.i         = jsContext.Object(
                new {
                    a = jsContext.Object( new { LastName="Torres", Age=46 } ),
                    b = jsContext.Object( new Person("Ferry", 47) ),
                }
            );
            string script = @"
                var p1 = {
                    Name : i.a.LastName,
                    Age  : i.a.Age
                }
                var p2 = {
                    Name : i.b.LastName,
                    Age  : i.b.Age
                }
            ";
            jsContext.Run(script);
            Assert.AreEqual("Torres", jsContext.p1.Name);
            Assert.AreEqual("Torres", jsContext.p1["Name"]);
            Assert.AreEqual("Torres", jsContext["p1"]["Name"]);

            Assert.AreEqual(46      , jsContext.p1.Age);
            Assert.AreEqual(46      , jsContext.p1["Age"]);
            Assert.AreEqual(46      , jsContext["p1"]["Age"]);

            Assert.AreEqual("Ferry" , jsContext.p2.Name);
            Assert.AreEqual("Ferry" , jsContext.p2["Name"]);
            Assert.AreEqual("Ferry" , jsContext["p2"]["Name"]);

            Assert.AreEqual(47      , jsContext.p2.Age);
            Assert.AreEqual(47      , jsContext.p2["Age"]);
            Assert.AreEqual(47      , jsContext["p2"]["Age"]);            
        }
        public void ReadingAConfiguration_NestedArrayOfObjectsLiteral() {

            dynamic jsContext = new DynamicJavascriptContext(new Noesis.Javascript.JavascriptContext());                        
            
            string script = @"
                Configuration =  {
                    Server   :    'TOTO', 
                    Database :    'Rene', 
                    Debug    :    true, 
                    MaxUser  :    3, 
                    Users    :    [
                        { UserName:'******'    ,FirstName:'rene'      ,LastName:'descartes'     }, 
                        { UserName:'******'       ,FirstName:'blaise'    ,LastName:'pascal'        }, 
                        { UserName:'******'  ,FirstName:'charles'   ,LastName:'montesquieu'   } 
                    ]
                }
            ";
            jsContext.Run(script);

            Assert.AreEqual("TOTO"      , jsContext.Configuration.Server);
            Assert.AreEqual("Rene"      , jsContext.Configuration.Database);
            Assert.AreEqual(true        , jsContext.Configuration.Debug);
            Assert.AreEqual(3           , jsContext.Configuration.MaxUser);
            Assert.AreEqual(3           , jsContext.Configuration.Users.Length);
            Assert.AreEqual("rdescartes", jsContext.Configuration.Users[0].UserName);

            Assert.AreEqual("TOTO"      , jsContext["Configuration"]["Server"]);
            Assert.AreEqual("Rene"      , jsContext["Configuration"]["Database"]);
            Assert.AreEqual(true        , jsContext["Configuration"]["Debug"]);
            Assert.AreEqual(3           , jsContext["Configuration"]["MaxUser"]);
            Assert.AreEqual(3           , jsContext["Configuration"]["Users"].Length);
            Assert.AreEqual("rdescartes", jsContext["Configuration"]["Users"][0].UserName);
        }