public async Task ItShouldLoadTheAppropriateMapAsync(
            string cultureName,
            string key,
            string expectedText,
            bool expectedSuccess,
            string resourcePath)
        {
            var cultureInfo = CultureInfo.GetCultureInfo(cultureName);

            var service = new EmbeddedJsonLocalizationExtensionService(Logger);

            var options = new EmbeddedJsonLocalizationOptions();

            options.ResourcesPath = resourcePath;

            var map = await service.TryLoadAsync(options, Assembly, BaseName, cultureInfo).ConfigureAwait(false);

            if (expectedSuccess)
            {
                Assert.NotNull(map);
                Assert.Equal(expectedText, map[key]);
            }
            else
            {
                Assert.Null(map);
            }
        }
Beispiel #2
0
        public async Task ItShouldLoadTheAppropriateMapAsync()
        {
            var cultureName  = "en-US";
            var resourcePath = "Resources";
            var cultureInfo  = CultureInfo.GetCultureInfo(cultureName);

            var service = new EmbeddedJsonLocalizationExtensionService(Logger);

            var options = new EmbeddedJsonLocalizationOptions();

            options.ResourcesPath = resourcePath;

            var map = await service.TryLoadAsync(options, Assembly, BaseName, cultureInfo).ConfigureAwait(false);

            Assert.NotNull(map);
            Assert.Equal("Text for auswählen", map["auswählen"]);
            Assert.Equal("Text for été", map["été"]);
            Assert.Equal("こんにちは", map["konnichiwa"]);
            Assert.Equal("سعادة", map["Happiness"]);
        }