示例#1
0
        public void Test18()
        {
            var data = new DataDictionaryKey();

            data.List      = new Dictionary <object, object>();
            data.List["A"] = "X";
            data.List["D"] = null;
            string json  = Framework.Server.Json.Util.Serialize(data);
            var    data2 = Framework.Server.Json.Util.Deserialize <DataDictionaryKey>(json);

            Util.Assert((string)data2.List["A"] == "X");
            Util.Assert(data2.List["D"] == null);
        }
示例#2
0
        public void Test19()
        {
            var data = new DataDictionaryKey();

            data.List      = new Dictionary <object, object>();
            data.List["A"] = "X";
            data.List[8]   = null;
            try
            {
                string json = Framework.Server.Json.Util.Serialize(data);
            }
            catch (Framework.Server.Json.JsonException exception)
            {
                Util.Assert(exception.Message == "Dictionary key needs to be of type string!");
            }
        }