Esempio n. 1
0
        public void HasEuroAsDefault()
        {
            var locale = _locales.GetLocale("pt-PT");

            Assert.NotNull(locale);
            Assert.True(locale.Culture.Name.Equals("pt-PT"));
            Assert.True(locale.Culture.TwoLetterISOLanguageName.Equals("pt"));
            Assert.True(locale.Region.TwoLetterISORegionName.Equals("PT"));

            var currency = _currencies.GetDefaultCurrency(locale);

            Assert.NotNull(currency);
            Assert.True(currency.Code.Equals("EUR"));
            Assert.True(currency.Scale.Equals(2));
        }
Esempio n. 2
0
        public MessageRepositoryUnitTest()
        {
            _locales = new LocaleRepository
                       (
                new EnvironmentLocaleFactory()
                       );

            _messages = new MessageRepository
                        (
                new MachineObjectMessageFactory()
                        );

            _english = _locales.GetLocale("en-US");

            _portuguese = _locales.GetLocale("pt-PT");
        }
Esempio n. 3
0
        public void HasEverySystemLocale()
        {
            foreach (var culture in CultureInfo.GetCultures(CultureTypes.SpecificCultures))
            {
                var region = new RegionInfo(culture.Name);

                var locale = _locales.GetLocale(culture.Name);

                Assert.NotNull(locale);
                Assert.NotNull(locale.Culture);
                Assert.NotNull(locale.Region);

                Assert.False(locale.Culture.IsNeutralCulture);

                Assert.True(locale.Culture.Equals(culture));
                Assert.True(locale.Region.Equals(region));
            }
        }
Esempio n. 4
0
        public CurrencyFormatterUnitTest()
        {
            _currencyRepository = new CurrencyRepository(new EnvironmentCurrencyFactory());
            _localeRepository   = new LocaleRepository(new EnvironmentLocaleFactory());

            _locale              = _localeRepository.GetLocale("pt-PT");
            _currency            = _currencyRepository.GetDefaultCurrency(_locale);
            _alternativeCurrency = _currencyRepository.GetCurrency("USD");

            _currencyFormatter = new CurrencyFormatter();

            _alternativeCurrencyNumberFormatInfo = (NumberFormatInfo)_locale.Culture.NumberFormat.Clone();
            _alternativeCurrencyNumberFormatInfo.CurrencyDecimalDigits = _alternativeCurrency.Scale;
            _alternativeCurrencyNumberFormatInfo.CurrencySymbol        = _alternativeCurrency.Symbol;
        }