Exemple #1
0
        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"));
            }
        }
Exemple #2
0
        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);
                }
            }
        }
Exemple #3
0
        public static System.Boolean DeleteOPCSampleGrpTSS(
            OPCSampleGrpConfig.Model.OPCSampleGrpConfigStartModel target,
            System.String opcSampelGrpId)
        {
            string name = Dottest.Framework.Stubs.CurrentTestMethod.Name;

            if (name.Equals("TestIntervalConfigDataGridView_CellDoubleClick03"))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #4
0
        public static System.Boolean DeleteOPCSampleGrpMSS(
            OPCSampleGrpConfig.Model.OPCSampleGrpConfigStartModel target,
            System.String opcSampelGrpId)
        {
            object result;

            if (TestSpecificStubsUtil.RunTestSpecificStub(System.Reflection.MethodBase.GetCurrentMethod(), new object[] { target, opcSampelGrpId }, out result))
            {
                return((System.Boolean)result);
            }
            else
            {
                return(target.DeleteOPCSampleGrp(opcSampelGrpId));
            }
        }
Exemple #5
0
 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);
     }
 }
Exemple #6
0
 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);
     }
 }
Exemple #7
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);
            }
        }
Exemple #8
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);
            }
        }
Exemple #9
0
        public void TestLoadPageNumber01()
        {
            using (OPCSampleGrpConfigStart oPCSampleGrpConfigStart = (OPCSampleGrpConfigStart)ViewManager.GetInstance().GetView(OPCSampleGrpConfigStart.OPCSAMPLEGRPCONFIGSTARTFRM))
            {
                Accessor    oPCSampleGrpConfigStartAccessor = ReflectionAccessor.Wrap(oPCSampleGrpConfigStart);
                IModel      model      = new OPCSampleGrpConfig.Model.OPCSampleGrpConfigStartModel();
                IController controller = new OPCSampleGrpConfig.Controller.OPCSampleGrpConfigStartController();
                oPCSampleGrpConfigStart.ViewType = OPCSampleGrpConfigStart.OPCSAMPLEGRPCONFIGSTARTFRM;
                controller.Attach(model, oPCSampleGrpConfigStart);
                oPCSampleGrpConfigStartAccessor.Call("AttachListener", controller);
                oPCSampleGrpConfigStartAccessor.Call("InitializeIntervalConfigDataGridView");
                oPCSampleGrpConfigStartAccessor.Call("InitializeIntervalConfigDataGridView");
                oPCSampleGrpConfigStartAccessor.SetField("m_totalGrpCount", (int)10);
                oPCSampleGrpConfigStartAccessor.SetField("m_upperIndex", (int)10);
                oPCSampleGrpConfigStartAccessor.SetField("m_lowerIndex", (int)0);
                //System.Collections.Generic.List<EtyOPCSampleGroup> OPCSampleGrpList = DAO.Trending.OPCSampleGroupDAO.GetInstance().GetAllOPCGrpsByPage(0, 10);
                System.Collections.Generic.List <EtyDataLogDPGroupTrend> OPCSampleGrpList = new System.Collections.Generic.List <EtyDataLogDPGroupTrend>();
                EtyDataLogDPGroupTrend e1 = new EtyDataLogDPGroupTrend();
                EtyDataLogDPGroupTrend e2 = new EtyDataLogDPGroupTrend();
                EtyDataLogDPGroupTrend e3 = new EtyDataLogDPGroupTrend();
                EtyDataLogDPGroupTrend e4 = new EtyDataLogDPGroupTrend();
                EtyDataLogDPGroupTrend e5 = new EtyDataLogDPGroupTrend();
                EtyDataLogDPGroupTrend e6 = new EtyDataLogDPGroupTrend();
                EtyDataLogDPGroupTrend e7 = new EtyDataLogDPGroupTrend();
                EtyDataLogDPGroupTrend e8 = new EtyDataLogDPGroupTrend();
                EtyDataLogDPGroupTrend e9 = new EtyDataLogDPGroupTrend();
                e9.Disabled = true;
                EtyDataLogDPGroupTrend e10 = new EtyDataLogDPGroupTrend();

                OPCSampleGrpList.Add(e1);
                OPCSampleGrpList.Add(e2);
                OPCSampleGrpList.Add(e3);
                OPCSampleGrpList.Add(e4);
                OPCSampleGrpList.Add(e5);
                OPCSampleGrpList.Add(e6);
                OPCSampleGrpList.Add(e7);
                OPCSampleGrpList.Add(e8);
                OPCSampleGrpList.Add(e9);
                OPCSampleGrpList.Add(e10);

                oPCSampleGrpConfigStartAccessor.Call("LoadGridData", OPCSampleGrpList);


                //Test Procedure Call
                oPCSampleGrpConfigStartAccessor.Call("LoadPageNumber");
                //Post condition Check
                int totalRec = (int)oPCSampleGrpConfigStartAccessor.GetField("m_totalGrpCount");
                System.Windows.Forms.ToolStripLabel totalPgeNum = (System.Windows.Forms.ToolStripLabel)oPCSampleGrpConfigStartAccessor.GetField("totalIntervalConfigDataGridView");
                int TotalPageNumber = 1;
                TotalPageNumber = totalRec / 8;
                if (totalRec % 8 != 0)
                {
                    TotalPageNumber++;
                }
                System.Windows.Forms.NumericUpDown PageUpdm = (System.Windows.Forms.NumericUpDown)oPCSampleGrpConfigStartAccessor.GetField("pageNumIntervalConfigDataGridView");
                //System.Windows.Forms.DataGridView intervalDataGrid = (System.Windows.Forms.DataGridView)oPCSampleGrpConfigStartAccessor.GetField("intervalConfigDataGridView");
                Assert.AreEqual(TotalPageNumber.ToString(), totalPgeNum.Text);
                Assert.AreEqual(TotalPageNumber, PageUpdm.Maximum);

                //test2
                oPCSampleGrpConfigStartAccessor.SetField("m_totalGrpCount", (int)8);
                //Test Procedure Call
                oPCSampleGrpConfigStartAccessor.Call("LoadPageNumber");

                //test3
                oPCSampleGrpConfigStartAccessor.SetField("m_totalGrpCount", (int)0);
                //Test Procedure Call
                oPCSampleGrpConfigStartAccessor.Call("LoadPageNumber");
            }
        }