Exemplo n.º 1
0
        public void Should_provide_master_language_from_invariant()
        {
            var expected =
                new ContentData()
                .AddField("field1",
                          new ContentFieldData()
                          .AddValue("en", 3));

            var input =
                new ContentData()
                .AddField("field1",
                          new ContentFieldData()
                          .AddValue("iv", 3));

            var actual = input.ToApiModel(schema, languages, masterLanguage);

            Assert.Equal(expected, actual);
        }
Exemplo n.º 2
0
        public void Should_provide_invariant_from_first_language()
        {
            var expected =
                new ContentData()
                .AddField("field2",
                          new ContentFieldData()
                          .AddValue("iv", 2));

            var input =
                new ContentData()
                .AddField("field2",
                          new ContentFieldData()
                          .AddValue("de", 2)
                          .AddValue("it", 3));

            var actual = input.ToApiModel(schema, languagesConfig);

            Assert.Equal(expected, actual);
        }
Exemplo n.º 3
0
        public void Should_not_include_hidden_field()
        {
            var expected =
                new ContentData()
                .AddField("field2",
                          new ContentFieldData()
                          .AddValue("iv", 5));

            var input =
                new ContentData()
                .AddField("field2",
                          new ContentFieldData()
                          .AddValue("iv", 5))
                .AddField("field3",
                          new ContentFieldData()
                          .AddValue("iv", 2));

            var actual = input.ToApiModel(schema, languages, masterLanguage);

            Assert.Equal(expected, actual);
        }
Exemplo n.º 4
0
        public void Should_cleanup_old_languages()
        {
            var expected =
                new ContentData()
                .AddField("field1",
                          new ContentFieldData()
                          .AddValue("en", "en_string")
                          .AddValue("de", "de_string"));

            var input =
                new ContentData()
                .AddField("field1",
                          new ContentFieldData()
                          .AddValue("en", "en_string")
                          .AddValue("de", "de_string")
                          .AddValue("it", "it_string"));

            var actual = input.ToApiModel(schema, languages, masterLanguage);

            Assert.Equal(expected, actual);
        }