Example #1
0
        public void FlatteningWrapperOfTypeConverterCanSerializeGroupByWrapper()
        {
            // Arrange
            FlatteningWrapper <object> flatteningWrapper = new FlatteningWrapper <object>
            {
                GroupByContainer = new AggregationPropertyContainer()
                {
                    Name  = "TestProp",
                    Value = "TestValue"
                }
            };

            JDynamicTypeWrapperConverter converter = new JDynamicTypeWrapperConverter();

            // Act
            string json = SerializeUtils.WriteJson(converter, flatteningWrapper);

            // Assert
            Assert.Equal("{\"TestProp\":\"TestValue\"}", json);
        }
        public void FlatteningWrapperOfTypeConverterCanSerializeGroupByWrapper()
        {
            // Arrange
            FlatteningWrapper <object> flatteningWrapper = new FlatteningWrapper <object>
            {
                GroupByContainer = new AggregationPropertyContainer()
                {
                    Name  = "TestProp",
                    Value = "TestValue"
                }
            };

            JsonSerializerOptions options = new JsonSerializerOptions();
            FlatteningWrapperConverter <object> converter = new FlatteningWrapperConverter <object>();

            // Act
            string json = SerializeUtils.SerializeAsJson(jsonWriter => converter.Write(jsonWriter, flatteningWrapper, options));

            // Assert
            Assert.Equal("{\"TestProp\":\"TestValue\"}", json);
        }