示例#1
0
        private List <LanguageDto> GetAvailableLanguages()
        {
            var currentCulture = _settingProvider.GetCurrentCulture();

            return(_settingProvider.GetAvailableCultures()
                   .Select(x => CreateLanguageDto(x, currentCulture))
                   .ToList());
        }
        public async Task Load_ShowMenuWithAvailableLanguages()
        {
            // Arrange
            var currentCulture = new CultureInfo("en");
            var otherCulture   = new CultureInfo("es");

            _settingProvider.GetAvailableCultures().Returns(new List <CultureInfo> {
                currentCulture, otherCulture
            });
            _settingProvider.GetCurrentCulture().Returns(currentCulture);

            // Act
            await sut.Load();

            // Assert
            sut.AvailableLanguages.Should().HaveCount(2)
            .And.Contain(x => x.Culture == currentCulture && x.Current)
            .And.Contain(x => x.Culture == otherCulture && !x.Current);
        }