public void Should_return_flat_list_when_languages_specified() { var data = new ContentData() .AddField("field1", new ContentFieldData() .AddValue("de", 1) .AddValue("en", 2)) .AddField("field2", new ContentFieldData() .AddValue("de", null) .AddValue("en", 4)) .AddField("field3", new ContentFieldData() .AddValue("en", 6)) .AddField("field4", new ContentFieldData() .AddValue("it", 7)); var output = (Dictionary <string, JToken>)data.ToLanguageModel(new List <Language> { Language.DE, Language.EN }); var expected = new Dictionary <string, JToken> { { "field1", 1 }, { "field2", 4 }, { "field3", 6 } }; Assert.True(expected.EqualsDictionary(output)); }
public void Should_return_original_when_no_language_preferences_defined() { var data = new ContentData() .AddField("field1", new ContentFieldData() .AddValue("iv", 1)); Assert.Same(data, data.ToLanguageModel()); }