Beispiel #1
0
        public void Should_decode_json_values()
        {
            var source = JsonValue.Create("e30=");

            var result = ValueConverters.DecodeJson(TestUtils.DefaultSerializer)(source, jsonField);

            Assert.Equal(JsonValue.Object(), result);
        }
Beispiel #2
0
        public void Should_return_same_value_if_decoding_null_value()
        {
            var source = JsonValue.Null;

            var result = ValueConverters.DecodeJson(TestUtils.DefaultSerializer)(source, jsonField);

            Assert.Same(source, result);
        }
Beispiel #3
0
 public static NamedContentData FromMongoModel(this IdContentData result, Schema schema, IJsonSerializer serializer)
 {
     return(result.ConvertId2Name(schema,
                                  FieldConverters.ForValues(
                                      ValueConverters.DecodeJson(serializer)),
                                  FieldConverters.ForNestedId2Name(
                                      ValueConverters.DecodeJson(serializer))));
 }
Beispiel #4
0
        public void Should_return_same_value_if_decoding_null_value()
        {
            var source = JValue.CreateNull();

            var result = ValueConverters.DecodeJson()(source, jsonField);

            Assert.Same(source, result);
        }
Beispiel #5
0
        public void Should_decode_json_values()
        {
            var source = "e30=";

            var result = ValueConverters.DecodeJson()(source, jsonField);

            Assert.Equal(new JObject(), result);
        }
Beispiel #6
0
 public static NamedContentData FromMongoModel(this IdContentData result, Schema schema, List <Guid> deletedIds)
 {
     return(result.ConvertId2Name(schema,
                                  FieldConverters.ForValues(
                                      ValueConverters.DecodeJson(),
                                      ValueReferencesConverter.CleanReferences(deletedIds)),
                                  FieldConverters.ForNestedId2Name(
                                      ValueConverters.DecodeJson(),
                                      ValueReferencesConverter.CleanReferences(deletedIds))));
 }
Beispiel #7
0
        public DataConverter(IJsonSerializer serializer)
        {
            var decoder = ValueConverters.DecodeJson(serializer);

            decodeJsonConverters = new[]
            {
                FieldConverters.ForValues(decoder, ValueConverters.ForNested(decoder))
            };

            var encoder = ValueConverters.EncodeJson(serializer);

            encodeJsonConverters = new[]
            {
                FieldConverters.ForValues(encoder, ValueConverters.ForNested(encoder))
            };
        }
Beispiel #8
0
        public DataConverter(IJsonSerializer serializer)
        {
            decodeJsonConverters = new[]
            {
                FieldConverters.ForValues(
                    ValueConverters.DecodeJson(serializer)),
                FieldConverters.ForNestedId2Name(
                    ValueConverters.DecodeJson(serializer))
            };

            encodeJsonConverters = new[]
            {
                FieldConverters.ForValues(
                    ValueConverters.EncodeJson(serializer)),
                FieldConverters.ForNestedName2Id(
                    ValueConverters.EncodeJson(serializer))
            };
        }