示例#1
0
        public void Should_return_same_values_if_encoding_non_json_field()
        {
            var source =
                new ContentFieldData()
                .AddValue("en", null);

            var result = FieldConverters.EncodeJson()(source, stringLanguageField);

            Assert.Same(source, result);
        }
示例#2
0
        public void Should_encode_json_values()
        {
            var source =
                new ContentFieldData()
                .AddValue("en", null)
                .AddValue("de", JToken.FromObject(new { Value = 1 }));

            var result = FieldConverters.EncodeJson()(source, Fields.Json(1, "1", Partitioning.Invariant));

            Assert.Null(result["en"]);
            Assert.True(result["de"].Type == JTokenType.String);
        }
示例#3
0
 public static IdContentData ToMongoModel(this NamedContentData result, Schema schema)
 {
     return(result.ToIdModel(schema, FieldConverters.EncodeJson()));
 }