Esempio n. 1
0
        public void Example()
        {
            #region Usage
            JavaScriptSettings settings = new JavaScriptSettings
            {
                OnLoadFunction   = new JRaw("OnLoad"),
                OnUnloadFunction = new JRaw("function(e) { alert(e); }")
            };

            string json = JsonConvert.SerializeObject(settings, Formatting.Indented);

            Console.WriteLine(json);
            // {
            //   "OnLoadFunction": OnLoad,
            //   "OnUnloadFunction": function(e) { alert(e); }
            // }
            #endregion

            StringAssert.AreEqual(
                @"{
  ""OnLoadFunction"": OnLoad,
  ""OnUnloadFunction"": function(e) { alert(e); }
}",
                json
                );
        }
Esempio n. 2
0
        public void Example()
        {
            #region Usage
            JavaScriptSettings settings = new JavaScriptSettings
            {
                OnLoadFunction = new JRaw("OnLoad"),
                OnUnloadFunction = new JRaw("function(e) { alert(e); }")
            };

            string json = JsonConvert.SerializeObject(settings, Formatting.Indented);

            Console.WriteLine(json);
            // {
            //   "OnLoadFunction": OnLoad,
            //   "OnUnloadFunction": function(e) { alert(e); }
            // }
            #endregion
        }