예제 #1
0
        public void TestTranslateCaption01()
        {
            using (OPCSampleGrpConfigStart oPCSampleGrpConfigStart = OPCSampleGrpConfigStartFactory.CreateOPCSampleGrpConfigStart01())
            {
                //Test 1 ---   testing for english language setting
                //Test Procedure call
                oPCSampleGrpConfigStart.TranslateCaption();

                #region PostConditionCheck
                //Post Condition Check
                Accessor opcStartaccessor = ReflectionAccessor.Wrap(oPCSampleGrpConfigStart);
                Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.DP_GRP_NAME, ((System.Windows.Forms.Label)opcStartaccessor.GetField("label1")).Text);
                Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.DP_GRP_DES, ((System.Windows.Forms.Label)opcStartaccessor.GetField("label2")).Text);
                Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.START_TIME, ((System.Windows.Forms.Label)opcStartaccessor.GetField("label3")).Text);
                Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.DELTA_VALUE, ((System.Windows.Forms.Label)opcStartaccessor.GetField("label4")).Text);
                Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.INTERVAL_UNIT, ((System.Windows.Forms.Label)opcStartaccessor.GetField("label6")).Text);
                Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.INTERVAL_LENGTH, ((System.Windows.Forms.Label)opcStartaccessor.GetField("label7")).Text);
                Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.DISABLE, ((System.Windows.Forms.CheckBox)opcStartaccessor.GetField("disableCheckBox")).Text);
                Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.CANCLE, ((System.Windows.Forms.Button)opcStartaccessor.GetField("cancelMsgCmd")).Text);
                Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.SAVE, ((System.Windows.Forms.Button)opcStartaccessor.GetField("saveMsgCmd")).Text);
                Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.TOTAL_PAGE, ((System.Windows.Forms.ToolStripLabel)opcStartaccessor.GetField("TotalPage_Tlbl")).Text);
                Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.TITLE, oPCSampleGrpConfigStart.Text);
                System.Windows.Forms.ComboBox intervalCombo = (System.Windows.Forms.ComboBox)opcStartaccessor.GetField("intervalTypeBox");
                Assert.AreEqual(3, intervalCombo.Items.Count);
                Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.HOUR, intervalCombo.Items[OPCSampleGrpConfigStart.INTERVALETYPE_HOUR_INDEX]);
                Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.MINITE, intervalCombo.Items[OPCSampleGrpConfigStart.INTERVALETYPE_MINUTE_INDEX]);
                Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.SECOND, intervalCombo.Items[OPCSampleGrpConfigStart.INTERVALETYPE_SECOND_INDEX]);
                #endregion

                //Test2 --- testing chinese language settings.

                LanguageTypeHelper.GetInstance().SetLanaguageType(LanguageType.Chinese);
                oPCSampleGrpConfigStart.TranslateCaption();

                #region PostConditionCheck
                //Post Condition Check
                opcStartaccessor = ReflectionAccessor.Wrap(oPCSampleGrpConfigStart);
                Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.DP_GRP_NAME, ((System.Windows.Forms.Label)opcStartaccessor.GetField("label1")).Text);
                Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.DP_GRP_DES, ((System.Windows.Forms.Label)opcStartaccessor.GetField("label2")).Text);
                Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.START_TIME, ((System.Windows.Forms.Label)opcStartaccessor.GetField("label3")).Text);
                Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.DELTA_VALUE, ((System.Windows.Forms.Label)opcStartaccessor.GetField("label4")).Text);
                Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.INTERVAL_UNIT, ((System.Windows.Forms.Label)opcStartaccessor.GetField("label6")).Text);
                Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.INTERVAL_LENGTH, ((System.Windows.Forms.Label)opcStartaccessor.GetField("label7")).Text);
                Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.DISABLE, ((System.Windows.Forms.CheckBox)opcStartaccessor.GetField("disableCheckBox")).Text);
                Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.CANCLE, ((System.Windows.Forms.Button)opcStartaccessor.GetField("cancelMsgCmd")).Text);
                Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.SAVE, ((System.Windows.Forms.Button)opcStartaccessor.GetField("saveMsgCmd")).Text);
                Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.TOTAL_PAGE, ((System.Windows.Forms.ToolStripLabel)opcStartaccessor.GetField("TotalPage_Tlbl")).Text);
                Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.TITLE, oPCSampleGrpConfigStart.Text);
                intervalCombo = (System.Windows.Forms.ComboBox)opcStartaccessor.GetField("intervalTypeBox");
                Assert.AreEqual(3, intervalCombo.Items.Count);
                Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.HOUR, intervalCombo.Items[OPCSampleGrpConfigStart.INTERVALETYPE_HOUR_INDEX]);
                Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.MINITE, intervalCombo.Items[OPCSampleGrpConfigStart.INTERVALETYPE_MINUTE_INDEX]);
                Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.SECOND, intervalCombo.Items[OPCSampleGrpConfigStart.INTERVALETYPE_SECOND_INDEX]);
                LanguageTypeHelper.GetInstance().SetLanaguageType(LanguageType.English);
                #endregion
            }
        }
예제 #2
0
        public void TestAddLoggerInterval_Load01()
        {
            using (OPCSampleGrpConfigStart oPCSampleGrpConfigStart = OPCSampleGrpConfigStartFactory.CreateOPCSampleGrpConfigStart01())
            {
                //Test1 = Exception thrown
                IModel      model      = new OPCSampleGrpConfig.Model.OPCSampleGrpConfigStartModel();
                IController controller = new OPCSampleGrpConfig.Controller.OPCSampleGrpConfigStartController();
                oPCSampleGrpConfigStart.ViewType = OPCSampleGrpConfigStart.OPCSAMPLEGRPCONFIGSTARTFRM;
                controller.Attach(model, oPCSampleGrpConfigStart);
                Accessor oPCSampleGrpConfigStartAccessor = ReflectionAccessor.Wrap(oPCSampleGrpConfigStart);
                oPCSampleGrpConfigStartAccessor.Call("AttachListener", controller);
                //Test Procedure Call
                oPCSampleGrpConfigStartAccessor.Call("AddLoggerInterval_Load", null, null);

                //test2
                oPCSampleGrpConfigStart.TranslateCaption();
                //Test Procedure Call
                oPCSampleGrpConfigStartAccessor.Call("AddLoggerInterval_Load", null, null);
            }
        }
예제 #3
0
        public void TestSetEditFields01()
        {
            using (OPCSampleGrpConfigStart oPCSampleGrpConfigStart = OPCSampleGrpConfigStartFactory.CreateOPCSampleGrpConfigStart01())
            {
                //Test1 = Exception thrown
                IModel      model      = new OPCSampleGrpConfig.Model.OPCSampleGrpConfigStartModel();
                IController controller = new OPCSampleGrpConfig.Controller.OPCSampleGrpConfigStartController();
                oPCSampleGrpConfigStart.ViewType = OPCSampleGrpConfigStart.OPCSAMPLEGRPCONFIGSTARTFRM;
                controller.Attach(model, oPCSampleGrpConfigStart);
                Accessor oPCSampleGrpConfigStartAccessor = ReflectionAccessor.Wrap(oPCSampleGrpConfigStart);
                oPCSampleGrpConfigStartAccessor.Call("AttachListener", controller);
                EtyDataLogDPGroupTrend ety = new EtyDataLogDPGroupTrend();
                ety.Disabled   = true;
                ety.StartTime  = "10:30";
                ety.DeltaValue = 1;
                //Test Procedure Call
                oPCSampleGrpConfigStartAccessor.Call("SetEditFields", ety);


                //Test2
                oPCSampleGrpConfigStart.TranslateCaption();
                oPCSampleGrpConfigStartAccessor.Call("SetEditFields", ety);
            }
        }