Exemplo n.º 1
0
        public void ShouldIncludeNullObjects()
        {
            var    data       = new DefaultsModel();
            var    serializer = GetSerializer();
            string json       = serializer.Serialize(data);

            Assert.Equal(@"{""number"":0,""bool"":false,""message"":null,""collection"":null,""dictionary"":null}", json);
        }
Exemplo n.º 2
0
        public void WillIgnoreEmptyCollections()
        {
            var data = new DefaultsModel {
                Message    = "Testing",
                Collection = new Collection <string>(),
                Dictionary = new Dictionary <string, string>()
            };
            var    serializer = GetSerializer();
            string json       = serializer.Serialize(data, new[] { nameof(DefaultsModel.Bool), nameof(DefaultsModel.Number) });

            Assert.Equal(@"{""message"":""Testing""}", json);
        }