public void Should_AddTranslationFromSettingsHolder_AndModifyItByWithTranslationFromSettings() { var holder = new TestClassSpecificationAndTranslationHolder() { Specification = c => c, Settings = s => s .WithTranslation(new Dictionary <string, IReadOnlyDictionary <string, string> >() { ["name"] = new Dictionary <string, string>() { ["k1"] = "v1", }, ["English"] = new Dictionary <string, string>() { ["Global.Required"] = "OVERWRITTEN", ["TotallyNewKey"] = "NEW", } }) }; var dictionary = new Dictionary <string, IReadOnlyDictionary <string, string> >() { ["name"] = new Dictionary <string, string>() { ["k2"] = "v2", }, ["English"] = new Dictionary <string, string>() { ["Global.Required"] = "DOUBLE_OVERWRITTEN", ["TimeSpanType.GreaterThanOrEqualTo"] = "ANOTHER_OVERWRITTEN", ["TotallyNewKey2"] = "NEW2", } }; var validator = Validator.Factory.Create(holder, o => o.WithTranslation(dictionary)); var expectedModifiedEnglish = new Dictionary <string, string>(); foreach (var pair in Translation.English) { expectedModifiedEnglish.Add(pair.Key, pair.Value); } expectedModifiedEnglish.Add("TotallyNewKey", "NEW"); expectedModifiedEnglish.Add("TotallyNewKey2", "NEW2"); expectedModifiedEnglish["Global.Required"] = "DOUBLE_OVERWRITTEN"; expectedModifiedEnglish["TimeSpanType.GreaterThanOrEqualTo"] = "ANOTHER_OVERWRITTEN"; validator.Settings.Translations.ShouldBeLikeTranslations( new Dictionary <string, IReadOnlyDictionary <string, string> >() { ["English"] = expectedModifiedEnglish, ["name"] = new Dictionary <string, string>() { ["k1"] = "v1", ["k2"] = "v2", }, }); }
public void Should_AddTranslationFromSettingsHolder() { var holder = new TestClassSpecificationAndTranslationHolder() { Specification = c => c, Settings = s => s .WithTranslation(new Dictionary <string, IReadOnlyDictionary <string, string> >() { ["name"] = new Dictionary <string, string>() { ["k1"] = "v1", }, ["English"] = new Dictionary <string, string>() { ["Global.Required"] = "OVERWRITTEN", ["TotallyNewKey"] = "NEW", } }) }; var validator = Validator.Factory.Create(holder); var expectedModifiedEnglish = new Dictionary <string, string>(); foreach (var pair in Translation.English) { expectedModifiedEnglish.Add(pair.Key, pair.Value); } expectedModifiedEnglish.Add("TotallyNewKey", "NEW"); expectedModifiedEnglish["Global.Required"] = "OVERWRITTEN"; validator.Settings.Translations.ShouldBeLikeTranslations( new Dictionary <string, IReadOnlyDictionary <string, string> >() { ["English"] = expectedModifiedEnglish, ["name"] = new Dictionary <string, string>() { ["k1"] = "v1", }, }); }