Exemple #1
0
        public void Should_serialize_collection_property(Type type, object value, CultureInfo culture)
        {
            SkipUnsupportedDataType(type, value);

            using var cultureContext = culture.CreateContext();

            var property = new Property("p1", value);
            var model    = ProtoBufTypeModel.ConfigureAquaTypes(configureDefaultSystemTypes: false)
                           .AddDynamicPropertyType(TypeHelper.GetElementType(type), addSingleValueSuppoort: false, addNullableSupport: type.IsNullableType())
                           .Compile();
            var copy = property.Serialize(model);

            copy.Value.ShouldBe(value);
        }
Exemple #2
0
        public void Should_serialize_property_set(Type type, object value, CultureInfo culture)
        {
            SkipUnsupportedDataType(type, value);

            using var cultureContext = culture.CreateContext();

            var propertySet = new PropertySet
            {
                { "p1", value },
            };

            var config = ProtoBufTypeModel.ConfigureAquaTypes(configureDefaultSystemTypes: false)
                         .AddDynamicPropertyType(TypeHelper.GetElementType(type) ?? type)
                         .Compile();
            var copy = propertySet.Serialize(config);

            copy["p1"].ShouldBe(value);
        }