Пример #1
0
        public static void Init(TestContext context)
        {
            provider   = new InMemoryTranslationProvider();
            translator = new Translator(provider);

            LanguageSetting.Instant.CurrentLanguage = Language.GetByEnum(Languages.English_UnitedStates);
            LanguageSetting.Instant.DefaultLanguage = Language.GetByEnum(Languages.English_UnitedStates);
        }
Пример #2
0
        public void ValideTranslatorLanguageInstantTest3()
        {
            //- Arrange
            var provider   = new InMemoryTranslationProvider();
            var translator = new Translator(provider);

            //- Act
            var languageSetting = LanguageSetting.Instant;

            //- Assert
            Assert.ReferenceEquals(languageSetting, translator.LanguageSetting);
        }
Пример #3
0
        public void ValideTranslatorLanguageInstantTest2()
        {
            //- Arrange
            var provider        = new InMemoryTranslationProvider();
            var translator      = new Translator(provider);
            var languageSetting = LanguageSetting.Instant;
            var currentLang     = "";
            var oldLang         = "";

            translator.CurrentLanguageChanged += (s, e) =>
            {
                currentLang = e.NewLanguage.Code;
                oldLang     = e.OldLanguage.Code;
            };

            //- Act
            translator.LanguageSetting      = languageSetting;
            languageSetting.CurrentLanguage = Language.GetByEnum(Languages.Spanish_Spain);

            //- Assert
            Assert.AreEqual(Languages.Spanish_Spain.Code(), currentLang);
            Assert.AreEqual(Languages.English_UnitedStates.Code(), oldLang);
        }