public void Should_convert_to_id_model()
        {
            var input =
                new ContentData()
                .AddField("field1",
                          new ContentFieldData()
                          .AddValue("en", "en_string")
                          .AddValue("de", "de_string"))
                .AddField("field2",
                          new ContentFieldData()
                          .AddValue("iv", 3))
                .AddField("invalid",
                          new ContentFieldData()
                          .AddValue("iv", 3));

            var actual = input.ToIdModel(schema);

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

            Assert.Equal(expected, actual);
        }
Beispiel #2
0
        public void Should_convert_to_encoded_id_model()
        {
            var input =
                new ContentData()
                .AddField("json",
                          new ContentFieldData()
                          .AddValue("en", new JObject())
                          .AddValue("de", null)
                          .AddValue("it", JValue.CreateNull()));

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

            var expected =
                new ContentData()
                .AddField("4",
                          new ContentFieldData()
                          .AddValue("en", "e30=")
                          .AddValue("de", null)
                          .AddValue("it", null));

            Assert.Equal(expected, actual);
        }