コード例 #1
0
        public static void EmptyPropertyName()
        {
            string json = @"{"""":1}";

            {
                var obj = new EmptyPropertyName_TestClass();
                obj.MyInt1 = 1;

                string jsonOut = JsonSerializer.Serialize(obj);
                Assert.Equal(json, jsonOut);
            }

            {
                EmptyPropertyName_TestClass obj = JsonSerializer.Deserialize <EmptyPropertyName_TestClass>(json);
                Assert.Equal(1, obj.MyInt1);
            }
        }
コード例 #2
0
        public async Task EmptyPropertyName()
        {
            string json = @"{"""":1}";

            {
                var obj = new EmptyPropertyName_TestClass();
                obj.MyInt1 = 1;

                string jsonOut = await JsonSerializerWrapperForString.SerializeWrapper(obj);

                Assert.Equal(json, jsonOut);
            }

            {
                EmptyPropertyName_TestClass obj = await JsonSerializerWrapperForString.DeserializeWrapper <EmptyPropertyName_TestClass>(json);

                Assert.Equal(1, obj.MyInt1);
            }
        }