Example #1
0
            public void UseEnglishIfDefaultLanguage()
            {
                var nameManager = new NameManager <LocalizedStringWithId>();

                nameManager.SortNames.DefaultLanguage = ContentLanguageSelection.English;
                nameManager.Add(new LocalizedStringWithId("Japanese name", ContentLanguageSelection.Japanese));
                nameManager.Add(new LocalizedStringWithId("Romaji name", ContentLanguageSelection.Romaji));
                nameManager.Add(new LocalizedStringWithId("English name", ContentLanguageSelection.English));
                nameManager.UpdateSortNames();

                var result = UrlFriendlyNameFactory.GetUrlFriendlyName(nameManager);

                result.Should().Be("english-name");
            }
            public void PreferRomajiForJapanese()
            {
                var nameManager = new NameManager <LocalizedStringWithId>();

                nameManager.SortNames.DefaultLanguage = ContentLanguageSelection.Japanese;
                nameManager.Add(new LocalizedStringWithId("Japanese name", ContentLanguageSelection.Japanese));
                nameManager.Add(new LocalizedStringWithId("Romaji name", ContentLanguageSelection.Romaji));
                nameManager.Add(new LocalizedStringWithId("English name", ContentLanguageSelection.English));
                nameManager.UpdateSortNames();

                var result = UrlFriendlyNameFactory.GetUrlFriendlyName(nameManager);

                Assert.AreEqual("romaji-name", result);
            }
Example #3
0
 public virtual string GetUrlFriendlyName()
 {
     return(UrlFriendlyNameFactory.GetUrlFriendlyName(this));
 }
Example #4
0
            private void CallGetUrlFriendlyName(string expected, TranslatedString input)
            {
                var result = UrlFriendlyNameFactory.GetUrlFriendlyName(input);

                result.Should().Be(expected, input.ToString());
            }
            private void CallGetUrlFriendlyName(string expected, TranslatedString input)
            {
                var result = UrlFriendlyNameFactory.GetUrlFriendlyName(input);

                Assert.AreEqual(expected, result, input.ToString());
            }