示例#1
0
        public async Task Should_not_override_existing_languages()
        {
            var options = Options.Create(new LanguagesOptions
            {
                ["de"] = "German (Germany)"
            });

            var sut = new LanguagesInitializer(options);

            await sut.InitializeAsync();

            Assert.Equal("German", Language.GetLanguage("de").EnglishName);
        }
        public async Task Should_add_custom_languages()
        {
            var options = Options.Create(new LanguagesOptions
            {
                ["en-NO"] = "English (Norwegian)"
            });

            var sut = new LanguagesInitializer(options);

            await sut.InitializeAsync();

            Assert.Equal("English (Norwegian)", Language.GetLanguage("en-NO").EnglishName);
        }
示例#3
0
        public async Task Should_not_add_invalid_languages()
        {
            var options = Options.Create(new LanguagesOptions
            {
                ["en-Error"] = null
            });

            var sut = new LanguagesInitializer(options);

            await sut.InitializeAsync();

            Assert.False(Language.TryGetLanguage("en-Error", out _));
        }