public async Task WHEN_Passing_Any_Culture_Resulting_LocalizationCategories_SHOULD_Not_Be_Null()
        {
            //Arrange
            var         localizationProvider = LocalizationProviderFactory.CreateFromTestAssets();
            CultureInfo culture = CultureInfo.GetCultureInfo("es-MX");

            //Act
            LocalizationTree tree = await localizationProvider.GetLocalizationTreeAsync(culture);

            //Assert
            tree.LocalizedCategories.Should().NotBeNull();
        }
        public async Task WHEN_Passing_Any_Culture_SHOULD_Contain_All_Categories(string expectedCategory)
        {
            //Arrange
            var         localizationProvider = LocalizationProviderFactory.CreateFromTestAssets();
            CultureInfo culture = CultureInfo.GetCultureInfo("es-US");

            //Act
            LocalizationTree tree = await localizationProvider.GetLocalizationTreeAsync(culture);

            //Assert
            tree.LocalizedCategories.Values.Should().Contain(c => c.CategoryName == expectedCategory);
            tree.LocalizedCategories.Should().ContainKey(expectedCategory.ToLowerInvariant(), "Because Javascript expect lowercase for case insentivity");
        }
        public async Task WHEN_Passing_A_Given_Culture_SHOULD_Contain_The_Most_Relevant_Value_For_Each_Keys(string cultureName, string category, string key, string expectedValue)
        {
            //Arrange
            var         localizationProvider = LocalizationProviderFactory.CreateFromTestAssets();
            CultureInfo culture = CultureInfo.GetCultureInfo(cultureName);

            //Act
            LocalizationTree tree = await localizationProvider.GetLocalizationTreeAsync(culture);

            //Assert
            tree.LocalizedCategories.Values.Should().Contain(c => c.CategoryName == category);
            tree.LocalizedCategories.Should().ContainKey(category.ToLowerInvariant(), "Because Javascript expect lowercase for case insentivity");
            tree.LocalizedCategories[category.ToLowerInvariant()].LocalizedValues.Should().ContainKey(key);
            tree.LocalizedCategories[category.ToLowerInvariant()].LocalizedValues[key].Should().BeEquivalentTo(expectedValue);
        }
        public async Task WHEN_Passing_Any_Culture_Resulting_TreeStructure_SHOULD_Be_Cached_ByCulture()
        {
            //Arrange
            CacheProviderFactory.CacheHistMonitor monitor = new CacheProviderFactory.CacheHistMonitor();
            LocalizationTree cachedTree = new LocalizationTree(CultureInfo.CurrentCulture);

            AutoMocker container = new AutoMocker();

            container.Use(CacheProviderFactory.CreateWithMonitor(monitor, cachedTree));
            container.Use(ComposerEnvironmentFactory.Create());

            ILocalizationProvider localizationProvider = container.CreateInstance <ResourceLocalizationProvider>();

            CultureInfo cultureA = CultureInfo.GetCultureInfo("fr-CA");
            CultureInfo cultureB = CultureInfo.GetCultureInfo("fr-FR");

            //Act
            monitor.Reset();
            monitor.CacheMissCount.ShouldBeEquivalentTo(0, "Otherwise this test is irrelevent");
            monitor.CacheHitCount.ShouldBeEquivalentTo(0, "Otherwise this test is irrelevent");

            LocalizationTree tree1A = await localizationProvider.GetLocalizationTreeAsync(cultureA);

            monitor.CacheMissCount.ShouldBeEquivalentTo(1, "First attempt to load the CultureA should cache miss");

            LocalizationTree tree2A = await localizationProvider.GetLocalizationTreeAsync(cultureA);

            monitor.CacheHitCount.ShouldBeEquivalentTo(1, "Second attempt to load the CultureA should cache hit");

            monitor.Reset();
            for (int i = 0; i < 10; i++)
            {
                LocalizationTree tree3A = await localizationProvider.GetLocalizationTreeAsync(cultureA);
            }
            monitor.CacheMissCount.ShouldBeEquivalentTo(0, "Subsequent attempt to load the CultureA should not cache miss");
            monitor.CacheHitCount.Should().BeGreaterOrEqualTo(10, "Subsequent attempt to load the CultureA should cache hit");

            //--
            monitor.Reset();
            LocalizationTree tree1B = await localizationProvider.GetLocalizationTreeAsync(cultureB);

            monitor.CacheMissCount.ShouldBeEquivalentTo(1, "First attempt to load the CultureB should cache miss, key is culture dependant");
            monitor.CacheHitCount.ShouldBeEquivalentTo(0, "First attempt to load the CultureB should not cache hit, key is culture dependant");
        }