Exemple #1
0
        public void TestWrite()
        {
            JsonSerializerOptions options = new JsonSerializerOptions();

            options.SetupExtensions();

            object value = new SerializableError {
                { "key1", 12 }, { "key2", "value" }
            };
            const string json = @"{""key1"":12,""key2"":""value""}";

            string result = JsonSerializer.Serialize(value, value.GetType(), options);

            Assert.Equal(json, result);
        }