private void CheckInitIncludeProperties(INbJsonSerialize nbJsonSerialize) { var includeProperties = _dynamicHashModel.GetIncludeProperties(); includeProperties.Log(); includeProperties.Count.ShouldEqual(2); _dynamicHashModel.Set("Bar", () => "BAR"); var dynamicHashModel = _dynamicHashModel.AsDynamic(); dynamicHashModel.Foo = "FOO"; dynamicHashModel.Blah = (Func <string>)(() => { var message = "Should Not Invoke Here"; message.Log(); return(message); }); var httpGetJson = (string)nbJsonSerialize.Serialize(dynamicHashModel); httpGetJson.Log(); ((object)dynamicHashModel.Foo).ShouldEqual("FOO"); ((object)dynamicHashModel.Bar).ShouldEqual("BAR"); ((object)dynamicHashModel.Blah).ShouldNull("Blah"); }
public void Save <T>(string path, IList <T> list) { IList <T> listFix = new List <T>(); if (list != null) { listFix = list; } var jsonValue = NbJsonSerialize.Serialize(listFix, new NbJsonSerializeConfig() { Formatting = NbJsonFormatting.Indented }); SaveFile(path, jsonValue); }