public void TestAttachCallBack01() { IModel model = OPCSampleGrpConfigStartModelFactory.CreateOPCSampleGrpConfigStartModel01(); IView view = OPCSampleGrpConfigStartFactory.CreateOPCSampleGrpConfigStart01(); oPCSampleGrpConfigStartController.AttachCallBack(model, view); }
public void TestAttachListener01() { using (OPCSampleGrpConfigStart oPCSampleGrpConfigStart = OPCSampleGrpConfigStartFactory.CreateOPCSampleGrpConfigStart01()) { using (IController ctl = OPCSampleGrpConfigStartControllerFactory.CreateOPCSampleGrpConfigStartController01()) { //Test 1 --- testing for valid connection string //Test Procedure call OPCSampleGrpConfig.Model.OPCSampleGrpConfigStartModel model = OPCSampleGrpConfig.DotTest.Factories.Model.OPCSampleGrpConfigStartModelFactory.CreateOPCSampleGrpConfigStartModel01(); Accessor controllerAccessor = ReflectionAccessor.Wrap(ctl); controllerAccessor.Call("Attach", model, oPCSampleGrpConfigStart); oPCSampleGrpConfigStart.AttachListener(ctl); #region PostConditionCheck //Post Condition Check //Assert.AreNotEqual((int)DAO.Trending.Helper.LocationKeyHelper.GetInstance().LocationKey, 0); #endregion //Test 2 --- testing for invalid connection string DAO.Trending.Common.DBConnectionStrings.ReleaseInstance(); oPCSampleGrpConfigStart.AttachListener(ctl); DAO.Trending.Common.DBConnectionStrings.GetInstance().AddConnectionString(TrendingHelper.ConfigureFileHelper.GetInstance().ConnectionStringConfig); } } }
public void TestPopulateIntervalConfigDataGridView01() { using (OPCSampleGrpConfigStart oPCSampleGrpConfigStart = OPCSampleGrpConfigStartFactory.CreateOPCSampleGrpConfigStart01()) { 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); oPCSampleGrpConfigStartAccessor.Call("InitializeIntervalConfigDataGridView"); oPCSampleGrpConfigStartAccessor.Call("InitializeControlsCaptions"); int mode = 1; //Test Procedure Call oPCSampleGrpConfigStart.PopulateIntervalConfigDataGridView(mode); //Post condition Check Assert.AreEqual(1, oPCSampleGrpConfigStartAccessor.GetFieldAccessor("pageNumIntervalConfigDataGridView").GetProperty("Value")); //Test 2 mode = 2; oPCSampleGrpConfigStartAccessor.GetFieldAccessor("pageNumIntervalConfigDataGridView").SetProperty("Maximum", (Decimal)2); oPCSampleGrpConfigStartAccessor.GetFieldAccessor("pageNumIntervalConfigDataGridView").SetProperty("Value", (Decimal)2); //Test Procedure Call oPCSampleGrpConfigStart.PopulateIntervalConfigDataGridView(mode); //Post condition Check //Assert.AreEqual(2, oPCSampleGrpConfigStartAccessor.GetFieldAccessor("pageNumIntervalConfigDataGridView").GetProperty("Value")); } }
public void TestInitializeIntervalConfigDataGridView02() { //testing for Chinese Language using (OPCSampleGrpConfigStart oPCSampleGrpConfigStart = OPCSampleGrpConfigStartFactory.CreateOPCSampleGrpConfigStart01()) { //Test Procedure Call LanguageTypeHelper.GetInstance().SetLanaguageType(LanguageType.Chinese); Accessor oPCSampleGrpConfigStartAccessor = ReflectionAccessor.Wrap(oPCSampleGrpConfigStart); oPCSampleGrpConfigStartAccessor.Call("InitializeIntervalConfigDataGridView"); #region PostConditionCheck //Post Condition Check Accessor opcStartaccessor = ReflectionAccessor.Wrap(oPCSampleGrpConfigStart); System.Windows.Forms.DataGridView gridCtrl = (System.Windows.Forms.DataGridView)opcStartaccessor.GetField("intervalConfigDataGridView"); //Column count Assert.AreEqual(12, gridCtrl.ColumnCount); //column names Assert.AreEqual(OPCSampleGrpConfigStart.OPCSAMPLEGRPID_COL_NAME, gridCtrl.Columns[0].Name); Assert.AreEqual(OPCSampleGrpConfigStart.OPCSAMPLEGRPNAME_COL_NAME, gridCtrl.Columns[1].Name); Assert.AreEqual(OPCSampleGrpConfigStart.OPCSAMPLEGRPDESC_COL_NAME, gridCtrl.Columns[2].Name); Assert.AreEqual(OPCSampleGrpConfigStart.OPCSAMPLEINTERVAL_COL_NAME, gridCtrl.Columns[3].Name); Assert.AreEqual(OPCSampleGrpConfigStart.OPCSAMPLEINTERVALTYPE_COL_NAME, gridCtrl.Columns[4].Name); Assert.AreEqual(OPCSampleGrpConfigStart.OPCSAMPLESTARTTIME_COL_NAME, gridCtrl.Columns[5].Name); Assert.AreEqual(OPCSampleGrpConfigStart.OPCSAMPLEDELTAVAL_COL_NAME, gridCtrl.Columns[6].Name); Assert.AreEqual(OPCSampleGrpConfigStart.OPCSAMPLELOCATION_COL_NAME, gridCtrl.Columns[7].Name); Assert.AreEqual("", gridCtrl.Columns[8].Name); Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.OPCSAMPLEGRP_EDITCOLUMN_NAME, gridCtrl.Columns[9].Name); Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.OPCSAMPLEGRP_DELETECOL_NAME, gridCtrl.Columns[10].Name); Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.OPCSAMPLEGRP_CONFIGCOL_NAME, gridCtrl.Columns[11].Name); //column header English text Assert.AreEqual(opcStartaccessor.GetField("OPCSAMPLEGRPID_COL_TEXT"), gridCtrl.Columns[0].HeaderText); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.DATA_GROUP_NAME, gridCtrl.Columns[1].HeaderText); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.DESCRIPTION, gridCtrl.Columns[2].HeaderText); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.COLUMN_TIME_SPAN, gridCtrl.Columns[3].HeaderText); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.COLUMN_TIME_FRAME, gridCtrl.Columns[4].HeaderText); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.COLUMN_START_TIME, gridCtrl.Columns[5].HeaderText); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.COLUMN_DELTA_VALUE, gridCtrl.Columns[6].HeaderText); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.COLUMN_LOCATION, gridCtrl.Columns[7].HeaderText); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.DISABLE, gridCtrl.Columns[8].HeaderText); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.COLUMN_EDIT, gridCtrl.Columns[9].HeaderText); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.COLUMN_DELETE, gridCtrl.Columns[10].HeaderText); Assert.AreEqual(OPCSampleGrpConfig.Common.ChineseString.COLUMN_CONFIG, gridCtrl.Columns[11].HeaderText); //column width Assert.AreEqual(50, gridCtrl.Columns[0].Width); Assert.AreEqual(250, gridCtrl.Columns[1].Width); Assert.AreEqual(220, gridCtrl.Columns[2].Width); Assert.AreEqual(60, gridCtrl.Columns[3].Width); Assert.AreEqual(95, gridCtrl.Columns[4].Width); Assert.AreEqual(80, gridCtrl.Columns[5].Width); Assert.AreEqual(92, gridCtrl.Columns[6].Width); Assert.AreEqual(80, gridCtrl.Columns[7].Width); Assert.AreEqual(70, gridCtrl.Columns[8].Width); Assert.AreEqual(50, gridCtrl.Columns[9].Width); Assert.AreEqual(50, gridCtrl.Columns[10].Width); Assert.AreEqual(50, gridCtrl.Columns[11].Width); LanguageTypeHelper.GetInstance().SetLanaguageType(LanguageType.English); #endregion } }
public void TestInitializeComponent01() { using (OPCSampleGrpConfigStart oPCSampleGrpConfigStart = OPCSampleGrpConfigStartFactory.CreateOPCSampleGrpConfigStart01()) { Accessor oPCSampleGrpConfigStartAccessor = ReflectionAccessor.Wrap(oPCSampleGrpConfigStart); oPCSampleGrpConfigStartAccessor.Call("InitializeComponent"); } }
public void FixtureSetUp() { oPCSampleGrpConfigStartController = new OPCSampleGrpConfigStartController(); IModel model = new OPCSampleGrpConfig.Model.OPCSampleGrpConfigStartModel(); OPCSampleGrpConfig.View.OPCSampleGrpConfigStart viewob = OPCSampleGrpConfigStartFactory.CreateOPCSampleGrpConfigStart01(); oPCSampleGrpConfigStartController.Attach(model, viewob); }
public void TestlastIntervalConfigDataGridView_Click01() { using (OPCSampleGrpConfigStart oPCSampleGrpConfigStart = OPCSampleGrpConfigStartFactory.CreateOPCSampleGrpConfigStart01()) { Accessor oPCSampleGrpConfigStartAccessor = ReflectionAccessor.Wrap(oPCSampleGrpConfigStart); oPCSampleGrpConfigStartAccessor.Call("lastIntervalConfigDataGridView_Click", null, null); } }
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 } }
public void TestInitializeIntervalConfigDataGridView01() { using (OPCSampleGrpConfigStart oPCSampleGrpConfigStart = OPCSampleGrpConfigStartFactory.CreateOPCSampleGrpConfigStart01()) { DAO.Trending.Helper.LocationKeyHelper.GetInstance().init(); Accessor oPCSampleGrpConfigStartAccessor = ReflectionAccessor.Wrap(oPCSampleGrpConfigStart); oPCSampleGrpConfigStartAccessor.Call("InitializeIntervalConfigDataGridView"); #region PostConditionCheck //Post Condition Check Accessor opcStartaccessor = ReflectionAccessor.Wrap(oPCSampleGrpConfigStart); System.Windows.Forms.DataGridView gridCtrl = (System.Windows.Forms.DataGridView)opcStartaccessor.GetField("intervalConfigDataGridView"); //Column count Assert.AreEqual(12, gridCtrl.ColumnCount); //column names Assert.AreEqual(OPCSampleGrpConfigStart.OPCSAMPLEGRPID_COL_NAME, gridCtrl.Columns[0].Name); Assert.AreEqual(OPCSampleGrpConfigStart.OPCSAMPLEGRPNAME_COL_NAME, gridCtrl.Columns[1].Name); Assert.AreEqual(OPCSampleGrpConfigStart.OPCSAMPLEGRPDESC_COL_NAME, gridCtrl.Columns[2].Name); Assert.AreEqual(OPCSampleGrpConfigStart.OPCSAMPLEINTERVAL_COL_NAME, gridCtrl.Columns[3].Name); Assert.AreEqual(OPCSampleGrpConfigStart.OPCSAMPLEINTERVALTYPE_COL_NAME, gridCtrl.Columns[4].Name); Assert.AreEqual(OPCSampleGrpConfigStart.OPCSAMPLESTARTTIME_COL_NAME, gridCtrl.Columns[5].Name); Assert.AreEqual(OPCSampleGrpConfigStart.OPCSAMPLEDELTAVAL_COL_NAME, gridCtrl.Columns[6].Name); Assert.AreEqual(OPCSampleGrpConfigStart.OPCSAMPLELOCATION_COL_NAME, gridCtrl.Columns[7].Name); Assert.AreEqual("", gridCtrl.Columns[8].Name); Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.OPCSAMPLEGRP_EDITCOLUMN_NAME, gridCtrl.Columns[9].Name); Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.OPCSAMPLEGRP_DELETECOL_NAME, gridCtrl.Columns[10].Name); Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.OPCSAMPLEGRP_CONFIGCOL_NAME, gridCtrl.Columns[11].Name); //column header English text Assert.AreEqual(opcStartaccessor.GetField("OPCSAMPLEGRPID_COL_TEXT"), gridCtrl.Columns[0].HeaderText); Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.OPCSAMPLEGRPNAME_COL_TEXT, gridCtrl.Columns[1].HeaderText); Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.OPCSAMPLEGRPDESC_COL_TEXT, gridCtrl.Columns[2].HeaderText); Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.OPCSAMPLEINTERVAL_COL_TEXT, gridCtrl.Columns[3].HeaderText); Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.OPCSAMPLEINTERVALTYPE_COL_TEXT, gridCtrl.Columns[4].HeaderText); Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.OPCSAMPLESTARTTIME_COL_TEXT, gridCtrl.Columns[5].HeaderText); Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.OPCSAMPLEDELTAVAL_COL_TEXT, gridCtrl.Columns[6].HeaderText); Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.OPCSAMPLEGRP_LOCATIONCOL_NAME, gridCtrl.Columns[7].HeaderText); Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.OPCSAMPLEDISABLE_COL_TEXT, gridCtrl.Columns[8].HeaderText); Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.OPCSAMPLEGRP_EDITCOLUMN_NAME, gridCtrl.Columns[9].HeaderText); Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.OPCSAMPLEGRP_DELETECOL_NAME, gridCtrl.Columns[10].HeaderText); Assert.AreEqual(OPCSampleGrpConfig.Common.EnglishString.OPCSAMPLEGRP_CONFIGCOL_NAME, gridCtrl.Columns[11].HeaderText); //column width Assert.AreEqual(50, gridCtrl.Columns[0].Width); Assert.AreEqual(250, gridCtrl.Columns[1].Width); Assert.AreEqual(220, gridCtrl.Columns[2].Width); Assert.AreEqual(60, gridCtrl.Columns[3].Width); Assert.AreEqual(95, gridCtrl.Columns[4].Width); Assert.AreEqual(80, gridCtrl.Columns[5].Width); Assert.AreEqual(92, gridCtrl.Columns[6].Width); Assert.AreEqual(80, gridCtrl.Columns[7].Width); Assert.AreEqual(70, gridCtrl.Columns[8].Width); Assert.AreEqual(50, gridCtrl.Columns[9].Width); Assert.AreEqual(50, gridCtrl.Columns[10].Width); Assert.AreEqual(50, gridCtrl.Columns[11].Width); #endregion } }
public void TestGetDataGridValue01() { using (OPCSampleGrpConfigStart oPCSampleGrpConfigStart = OPCSampleGrpConfigStartFactory.CreateOPCSampleGrpConfigStart01()) { int nRow = 0; int nColumn = int.MinValue; string str = oPCSampleGrpConfigStart.GetDataGridValue(nRow, nColumn); } }
public void TestDispose01() { using (OPCSampleGrpConfigStart oPCSampleGrpConfigStart = OPCSampleGrpConfigStartFactory.CreateOPCSampleGrpConfigStart01()) { bool disposing = true; Accessor oPCSampleGrpConfigStartAccessor = ReflectionAccessor.Wrap(oPCSampleGrpConfigStart); oPCSampleGrpConfigStartAccessor.SetField("components", new System.ComponentModel.Container()); oPCSampleGrpConfigStartAccessor.Call("Dispose", disposing); } }
public void TestTotalNumberGrpSetter01() { using (OPCSampleGrpConfigStart oPCSampleGrpConfigStart = OPCSampleGrpConfigStartFactory.CreateOPCSampleGrpConfigStart01()) { int totalNumberGrp = int.MinValue; oPCSampleGrpConfigStart.TotalNumberGrp = totalNumberGrp; //Post Condition Check Accessor opcStartaccessor = ReflectionAccessor.Wrap(oPCSampleGrpConfigStart); Assert.AreEqual(totalNumberGrp, opcStartaccessor.GetProperty("TotalNumberGrp")); } }
public void TestpageNumIntervalConfigDataGridView_ValueChanged01() { using (OPCSampleGrpConfigStart oPCSampleGrpConfigStart = OPCSampleGrpConfigStartFactory.CreateOPCSampleGrpConfigStart01()) { 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); oPCSampleGrpConfigStartAccessor.Call("InitializeControlsCaptions"); oPCSampleGrpConfigStartAccessor.Call("InitializeIntervalConfigDataGridView"); oPCSampleGrpConfigStartAccessor.Call("pageNumIntervalConfigDataGridView_ValueChanged", null, null); } }
public void TestnextIntervalConfigDataGridView_Click01() { using (OPCSampleGrpConfigStart oPCSampleGrpConfigStart = OPCSampleGrpConfigStartFactory.CreateOPCSampleGrpConfigStart01()) { 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); oPCSampleGrpConfigStartAccessor.Call("InitializeIntervalConfigDataGridView"); oPCSampleGrpConfigStartAccessor.Call("InitializeControlsCaptions"); oPCSampleGrpConfigStartAccessor.GetFieldAccessor("pageNumIntervalConfigDataGridView").SetProperty("Maximum", (decimal)3); oPCSampleGrpConfigStartAccessor.Call("nextIntervalConfigDataGridView_Click", null, null); } }
public void TestResetEditFields01() { using (OPCSampleGrpConfigStart oPCSampleGrpConfigStart = OPCSampleGrpConfigStartFactory.CreateOPCSampleGrpConfigStart01()) { oPCSampleGrpConfigStart.ResetEditFields(); //Post condition Check Accessor oPCSampleGrpConfigStartAccessor = ReflectionAccessor.Wrap(oPCSampleGrpConfigStart); Assert.AreEqual("", oPCSampleGrpConfigStartAccessor.GetProperty("intervalNameTextBox.Text")); Assert.AreEqual("", oPCSampleGrpConfigStartAccessor.GetProperty("intervalDescTextBox.Text")); Assert.AreEqual(1, oPCSampleGrpConfigStartAccessor.GetProperty(" intervalUnitBox.Value")); Assert.AreEqual(OPCSampleGrpConfigStart.INTERVALETYPE_MINUTE_INDEX, oPCSampleGrpConfigStartAccessor.GetProperty("intervalTypeBox.SelectedIndex")); Assert.AreEqual(1, oPCSampleGrpConfigStartAccessor.GetProperty("deltaValueBox.Value")); Assert.AreEqual(false, oPCSampleGrpConfigStartAccessor.GetProperty("dateTimePicker.Checked")); Assert.AreEqual(true, oPCSampleGrpConfigStartAccessor.GetProperty("disableCheckBox.Checked")); Assert.AreEqual(false, oPCSampleGrpConfigStartAccessor.GetProperty("intervalNameTextBox.Enabled")); } }
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); } }
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); } }
public void TestGetEditFields01() { using (OPCSampleGrpConfigStart oPCSampleGrpConfigStart = OPCSampleGrpConfigStartFactory.CreateOPCSampleGrpConfigStart01()) { // with intervalTestName = NULL Accessor oPCSampleGrpConfigStartAccessor = ReflectionAccessor.Wrap(oPCSampleGrpConfigStart); //Test Procedure Call EtyDataLogDPGroupTrend etyOPCSampleGroup = oPCSampleGrpConfigStart.GetEditFields(); #region PostCheck //Post Condition check Assert.IsNull(etyOPCSampleGroup); #endregion //Test2 -Proper execution oPCSampleGrpConfigStartAccessor.GetFieldAccessor("intervalNameTextBox").SetProperty("Text", "ParasoftTesting"); //Test Procedure Call etyOPCSampleGroup = oPCSampleGrpConfigStart.GetEditFields(); #region PostCheck //Post Condition check Assert.AreEqual(((String)oPCSampleGrpConfigStartAccessor.GetFieldAccessor("intervalNameTextBox").GetProperty("Text")).ToString().Trim(), etyOPCSampleGroup.SampleGrpName); Assert.AreEqual(oPCSampleGrpConfigStartAccessor.GetFieldAccessor("intervalDescTextBox").GetProperty("Text"), etyOPCSampleGroup.SampleGrpDescription); Assert.AreEqual(oPCSampleGrpConfigStartAccessor.GetFieldAccessor("intervalUnitBox").GetProperty("Value"), etyOPCSampleGroup.Interval); string intervalTypestr = DAO.Trending.Helper.DAOHelper.MINITE; Assert.AreEqual(intervalTypestr, etyOPCSampleGroup.IntervalType); Assert.AreEqual(oPCSampleGrpConfigStartAccessor.GetFieldAccessor("disableCheckBox").GetProperty("Checked"), etyOPCSampleGroup.Disabled); Assert.AreEqual(oPCSampleGrpConfigStartAccessor.GetFieldAccessor("deltaValueBox").GetProperty("Value"), etyOPCSampleGroup.DeltaValue); bool bChecked = (bool)oPCSampleGrpConfigStartAccessor.GetFieldAccessor("dateTimePicker").GetProperty("Checked"); string str = ""; if (bChecked) { str = ((DateTime)oPCSampleGrpConfigStartAccessor.GetFieldAccessor("dateTimePicker").GetProperty("Value")).ToString("HH:mm"); } Assert.AreEqual(str, etyOPCSampleGroup.StartTime); string strrr = (string)oPCSampleGrpConfigStartAccessor.GetField("m_editIntervalGrpID"); bool bVal = false; if (strrr == "") { bVal = true; } Assert.AreEqual(bVal, etyOPCSampleGroup.NewData); #endregion //test3 invalid interval value try { oPCSampleGrpConfigStartAccessor.GetFieldAccessor("intervalUnitBox").SetProperty("Value", (decimal)0); //Test Procedure call etyOPCSampleGroup = oPCSampleGrpConfigStart.GetEditFields(); #region PostCheck //Post Condition check Assert.IsNull(etyOPCSampleGroup); #endregion } catch (System.Exception ex) { } //test4 different intervaltype oPCSampleGrpConfigStartAccessor.Call("InitializeControlsCaptions"); oPCSampleGrpConfigStartAccessor.GetFieldAccessor("intervalTypeBox").SetProperty("SelectedIndex", OPCSampleGrpConfigStart.INTERVALETYPE_HOUR_INDEX); //Test Procedure call etyOPCSampleGroup = oPCSampleGrpConfigStart.GetEditFields(); #region PostCheck //Post Condition check Assert.AreEqual(DAO.Trending.Helper.DAOHelper.HOUR, etyOPCSampleGroup.IntervalType); #endregion oPCSampleGrpConfigStartAccessor.GetFieldAccessor("intervalTypeBox").SetProperty("SelectedIndex", OPCSampleGrpConfigStart.INTERVALETYPE_SECOND_INDEX); //Test Procedure call etyOPCSampleGroup = oPCSampleGrpConfigStart.GetEditFields(); #region PostCheck //Post Condition check Assert.AreEqual(DAO.Trending.Helper.DAOHelper.SECOND, etyOPCSampleGroup.IntervalType); #endregion oPCSampleGrpConfigStartAccessor.GetFieldAccessor("intervalTypeBox").SetProperty("SelectedIndex", OPCSampleGrpConfigStart.INTERVALETYPE_MINUTE_INDEX); //Test Procedure call etyOPCSampleGroup = oPCSampleGrpConfigStart.GetEditFields(); #region PostCheck //Post Condition check Assert.AreEqual(DAO.Trending.Helper.DAOHelper.MINITE, etyOPCSampleGroup.IntervalType); #endregion } }