Example #1
0
        public void InitDebugRepository()
        {
            //Arrange
            I_HelloWorldRepository repEmpty = TestSettings.Get_HelloWorldRepository();
            I_HelloWorldRepository repLangs_NoTranslations = TestSettings.Get_HelloWorldRepository(true);
            I_HelloWorldRepository repLangsAndTranslations = TestSettings.Get_HelloWorldRepository(true, true);

            //Act

            //Assert
            Assert.Equal(0, repEmpty.GetAllLanguages().Count);
            Assert.Equal(0, repEmpty.GetAllTranslations().Count);

            Assert.Equal(4, repLangs_NoTranslations.GetAllLanguages().Count);
            Assert.Equal(0, repLangs_NoTranslations.GetAllTranslations().Count);

            Assert.Equal(4, repLangsAndTranslations.GetAllLanguages().Count);
            Assert.Equal(28, repLangsAndTranslations.GetAllTranslations().Count);
        }
        private void initLanguages()
        {
            foreach (KeyValuePair <string, string> lang in _repository.GetAllLanguages())
            {
                bool isLangAdded = false;
                foreach (int aID in UserView.subViews_availableLanguages)
                {
                    if (ViewStateManager.getViewFromViewState <IdDescriptionPaar>(aID).strProp_shortID == lang.Key)
                    {
                        isLangAdded = true;
                        break;
                    }
                }
                if (!isLangAdded)
                {
                    IdDescriptionPaar newLang = ViewStateManager.getViewFromViewState <IdDescriptionPaar>(0);
                    newLang.strProp_shortID     = lang.Key;
                    newLang.strProp_description = lang.Value;

                    UserView.subViews_availableLanguages.Add(newLang.viewID);
                    ViewStateManager.saveViewToViewState(newLang);
                }
            }
        }