Ejemplo n.º 1
0
        public void TestgetStringValue01()
        {
            StringHelper stringHelper = StringHelperFactory.CreateStringHelper01();
            string       iD           = "SampleID";
            string       textEnglish  = "test1";
            string       textChinese  = "TT";
            string       description  = string.Empty;

            stringHelper.AddStringItem(iD, textEnglish, textChinese, description);
            string defaultValue = "rrr";
            string str          = stringHelper.getStringValue(iD, defaultValue);

            //current language is chinese
            LanguageTypeHelper languageTypeHelper = LanguageTypeHelperFactory.CreateLanguageTypeHelper01();
            LanguageType       langType           = LanguageType.Chinese;

            languageTypeHelper.SetLanaguageType(langType);
            //Test Procedure Call
            str = stringHelper.getStringValue(iD, defaultValue);
            //Post Condition Check
            Assert.AreEqual(textChinese, str);

            //current language is English
            languageTypeHelper.SetLanaguageType(LanguageType.English);
            //Test Procedure Call
            str = stringHelper.getStringValue(iD, defaultValue);
            //Post Condition Check
            Assert.AreEqual(textEnglish, str);

            //Id is not in string helper
            //Test Procedure Call
            str = stringHelper.getStringValue("UnknownID", defaultValue);
            //Post Condition Check
            Assert.AreEqual(defaultValue, str);
        }
Ejemplo n.º 2
0
        public void TestSetLanaguageType02()
        {
            LanguageTypeHelper languageTypeHelper = LanguageTypeHelperFactory.CreateLanguageTypeHelper01();
            LanguageType       langType           = LanguageType.English;

            languageTypeHelper.SetLanaguageType(langType);
        }
Ejemplo n.º 3
0
        public void TestGetCurrentLanguageType01()
        {
            LanguageTypeHelper languageTypeHelper = LanguageTypeHelperFactory.CreateLanguageTypeHelper01();
            LanguageType       langType           = LanguageType.English;

            languageTypeHelper.SetLanaguageType(langType);
            LanguageType languageType = languageTypeHelper.GetCurrentLanguageType();

            //Post Condition Check
            Assert.AreEqual(langType, languageType);
        }
Ejemplo n.º 4
0
        public void TestSetLanaguageType01()
        {
            LanguageTypeHelper languageTypeHelper = LanguageTypeHelperFactory.CreateLanguageTypeHelper01();
            LanguageType       langType           = LanguageType.Default;

            languageTypeHelper.SetLanaguageType(langType);
            //Post Condition Check
            Accessor languageTypeHelperaccessor = ReflectionAccessor.Wrap(languageTypeHelper);

            Assert.AreEqual(langType, languageTypeHelperaccessor.GetField("m_langType"));
            Accessor dateTimeFormatterAccessor = ReflectionAccessor.Wrap(DateTimeFormatter.getInstance());

            Assert.AreEqual(languageTypeHelperaccessor.GetField("DateFormat_EN"), dateTimeFormatterAccessor.GetField("m_DateFormatStr"));

            //for chinese language
            langType = LanguageType.Chinese;
            languageTypeHelper.SetLanaguageType(langType);
            //Post Condition Check
            Assert.AreEqual(langType, languageTypeHelperaccessor.GetField("m_langType"));
            Assert.AreEqual(languageTypeHelperaccessor.GetField("DateFormat_CH"), dateTimeFormatterAccessor.GetField("m_DateFormatStr"));
        }