Beispiel #1
0
        public async Task When_converting_type_inheriting_from_dictionary_then_it_should_be_correct()
        {
            //// Act
            var dict = new DictionarySubType();

            dict.Foo = "abc";
            dict.Add("bar", new List <string> {
                "a", "b"
            });
            var json = JsonConvert.SerializeObject(dict);

            var schema = JsonSchema.FromType <DictionarySubType>();
            var data   = schema.ToJson();

            //// Assert
            Assert.Equal(JsonObjectType.Object, schema.ActualTypeSchema.Type);
            Assert.DoesNotContain("Foo", json);
            Assert.DoesNotContain("foo", json);
        }
        public async Task When_converting_type_inheriting_from_dictionary_then_it_should_be_correct()
        {
            //// Act
            var dict = new DictionarySubType();

            dict.Foo = "abc";
            dict.Add("bar", new List <string> {
                "a", "b"
            });
            var json = JsonConvert.SerializeObject(dict);

            var schema = await JsonSchema4.FromTypeAsync <DictionarySubType>();

            var data = schema.ToJson();

            //// Assert
            Assert.AreEqual(JsonObjectType.Object, schema.Type);
            Assert.IsFalse(json.Contains("Foo"));
            Assert.IsFalse(json.Contains("foo"));
        }