Пример #1
0
        public void Should_convert_to_from_id_model()
        {
            var input =
                new ContentData()
                .AddField("1",
                          new ContentFieldData()
                          .AddValue("en", "en_string")
                          .AddValue("de", "de_string"))
                .AddField("2",
                          new ContentFieldData()
                          .AddValue("iv", 3))
                .AddField("99",
                          new ContentFieldData()
                          .AddValue("iv", 3));

            var actual = input.ToNameModel(schema);

            var expected =
                new ContentData()
                .AddField("field1",
                          new ContentFieldData()
                          .AddValue("en", "en_string")
                          .AddValue("de", "de_string"))
                .AddField("field2",
                          new ContentFieldData()
                          .AddValue("iv", 3));

            Assert.Equal(expected, actual);
        }
Пример #2
0
        public void Should_convert_from_encoded_id_model()
        {
            var input =
                new ContentData()
                .AddField("4",
                          new ContentFieldData()
                          .AddValue("en", "e30=")
                          .AddValue("de", null)
                          .AddValue("it", null));

            var actual = input.ToNameModel(schema, true);

            Assert.True(actual["json"]["en"] is JObject);
        }