public void TestGetAllOPCSampelGrp01() { OPCSampleGrpConfigStartModel oPCSampleGrpConfigStartModel = OPCSampleGrpConfigStartModelFactory.CreateOPCSampleGrpConfigStartModel01(); string sortCol = string.Empty; string sortingOrder = string.Empty; int lowerRecord = -1; int upperRecord = 1; List <EtyDataLogDPGroupTrend> list = oPCSampleGrpConfigStartModel.GetAllOPCSampelGrp(sortCol, sortingOrder, lowerRecord, upperRecord); #region Record State ValueRecorder recorder = new ValueRecorder(); recorder.Record <int>(delegate { return((int)list.Capacity); }); recorder.Record <int>(delegate { return((int)list.Count); }); recorder.Record <bool>(delegate { return((bool)ReflectionAccessor.Wrap(list).GetProperty("System.Collections.Generic.ICollection<T>.IsReadOnly")); }); recorder.Record <bool>(delegate { return((bool)ReflectionAccessor.Wrap(list).GetProperty("System.Collections.ICollection.IsSynchronized")); }); recorder.Record <bool>(delegate { return((bool)ReflectionAccessor.Wrap(list).GetProperty("System.Collections.IList.IsFixedSize")); }); recorder.Record <bool>(delegate { return((bool)ReflectionAccessor.Wrap(list).GetProperty("System.Collections.IList.IsReadOnly")); }); recorder.FinishRecording(); #endregion // ExpectedException custom attribute was generated instead of // assertions since the test threw System.ArgumentOutOfRangeException #region PostConditionCheck Assert.AreEqual(0, list.Count); #endregion //Test2 ---- Valid Input sortCol = OPCSampleGrpConfigStart.OPCSAMPLEGRPDESC_COL_NAME; sortingOrder = OPCSampleGrpConfigStart.OPCSAMPLEGRP_SORT_ASC; lowerRecord = 0; upperRecord = 8; list = oPCSampleGrpConfigStartModel.GetAllOPCSampelGrp(sortCol, sortingOrder, lowerRecord, upperRecord); #region PostConditionCheck //Assert.Greater(0, list.Count); #endregion }
public void TestAttachCallBack01() { IModel model = OPCSampleGrpConfigStartModelFactory.CreateOPCSampleGrpConfigStartModel01(); IView view = OPCSampleGrpConfigStartFactory.CreateOPCSampleGrpConfigStart01(); oPCSampleGrpConfigStartController.AttachCallBack(model, view); }
public void TestUpdateDataPointDB01() { OPCSampleGrpConfigStartModel oPCSampleGrpConfigStartModel = OPCSampleGrpConfigStartModelFactory.CreateOPCSampleGrpConfigStartModel01(); double sampleGrpID = double.MinValue; oPCSampleGrpConfigStartModel.UpdateDataPointDB(sampleGrpID); //Test2---Valid input #region TestSetup //insert testing group EtyDataLogDPGroupTrend etySampleGrp = new EtyDataLogDPGroupTrend(); etySampleGrp.NewData = true; etySampleGrp.SampleGrpName = "DOTTestParasoftTesting123"; etySampleGrp.Interval = 1; etySampleGrp.IntervalType = "M"; etySampleGrp.Disabled = false; oPCSampleGrpConfigStartModel.InsertOPCSampleGrp(etySampleGrp); //getSampleId from DB List <EtyDataLogDPGroupTrend> list = oPCSampleGrpConfigStartModel.GetAllOPCSampelGrp(OPCSampleGrpConfigStart.OPCSAMPLEGRPDESC_COL_NAME, OPCSampleGrpConfigStart.OPCSAMPLEGRP_SORT_ASC); foreach (var item in list) { if (item.SampleGrpName.Equals("DOTTestParasoftTesting123")) { etySampleGrp = item; break; } } //insert testing Datapoint EtyDataLogDPTrend etyOPCDP = new EtyDataLogDPTrend(); etyOPCDP.OPCDataPointName = "DOTTestParasoftDP1.Value"; etyOPCDP.EntityKey = 20099999; etyOPCDP.OPCSampleGrpId = etySampleGrp.SampleGrpID; etyOPCDP.Disabled = false; DatalogDPTrendDAO.GetInstance().InsertOPCDataPoint(etyOPCDP); #endregion //Test Procedure Call oPCSampleGrpConfigStartModel.UpdateDataPointDB(etySampleGrp.SampleGrpID); //Post Condition Check #region PostConditionCheck bool bDisable = false; string sampleGrpIDstr = etySampleGrp.SampleGrpID.ToString(); //Get DataPoint from DB double sampleid = DatalogDPTrendDAO.GetInstance().GetGrpIDByDPName("DOTTestParasoftDP1.Value"); //Assert.IsTrue(bDisable); Assert.AreEqual(sampleid, -1); #endregion #region CleanUp //Clean up inserted test data in DB //Delete testing DP string localSQL = "Delete from OPC_DT_PT where DATA_PT_NAME = 'DOTTestParasoftDP1.Value'"; SimpleDatabase.GetInstance().ExecuteNonQuery(localSQL); //Delete Testing sampleGrp DatalogDPGroupTrendDAO.GetInstance().DeleteOPCSampleGroupById(etySampleGrp.SampleGrpID.ToString()); #endregion }
public void TestDeleteOPCSampleGrp02() { //invalid grp name OPCSampleGrpConfigStartModel oPCSampleGrpConfigStartModel = OPCSampleGrpConfigStartModelFactory.CreateOPCSampleGrpConfigStartModel01(); //Test Procedure CALL bool b = oPCSampleGrpConfigStartModel.DeleteOPCSampleGrp("12"); //Post Condition Check }
public void FixtureSetUp() { OPCSampleGrpConfig.Common.FormCaptionHelper.GetInstance().AddCaptionsToStringHelper(); TrendingHelper.ConfigureFileHelper.GetInstance().init(); LanguageTypeHelper.GetInstance().SetLanaguageType(LanguageType.English); OPCSampleGrpConfigStartModel oPCSampleGrpConfigStartModel = OPCSampleGrpConfigStartModelFactory.CreateOPCSampleGrpConfigStartModel01(); DBConnectionStrings.GetInstance().AddConnectionString(TrendingHelper.ConfigureFileHelper.GetInstance().ConnectionStringConfig); }
public void TestOpenConnection01() { OPCSampleGrpConfigStartModel oPCSampleGrpConfigStartModel = OPCSampleGrpConfigStartModelFactory.CreateOPCSampleGrpConfigStartModel01(); string connectionString = string.Empty; DBConnectionStrings.ReleaseInstance(); DBConnectionStrings.GetInstance().AddConnectionString(connectionString); bool b = false; try { b = oPCSampleGrpConfigStartModel.OpenConnection(); } catch (System.Exception ex) { } #region Record State ValueRecorder recorder = new ValueRecorder(); recorder.Record(b); recorder.FinishRecording(); #endregion // ExpectedException custom attribute was generated instead of // assertions since the test threw System.ArgumentOutOfRangeException #region PostConditionCheck //Assert.IsFalse(b); #endregion //Test invalid connection string connectionString = "DataSource: ; UserName =;Password=;"; DBConnectionStrings.ReleaseInstance(); DBConnectionStrings.GetInstance().AddConnectionString(connectionString); try { b = oPCSampleGrpConfigStartModel.OpenConnection(); } catch (System.Exception ex) { } #region PostConditionCheck Assert.IsFalse(b); #endregion //Test valid connection string DBConnectionStrings.ReleaseInstance(); DBConnectionStrings.GetInstance().AddConnectionString(ConfigureFileHelper.GetInstance().ConnectionStringConfig); b = oPCSampleGrpConfigStartModel.OpenConnection(); #region PostConditionCheck Assert.IsTrue(b); #endregion }
public void TestGetAllOPCSampelGrp02() { OPCSampleGrpConfigStartModel oPCSampleGrpConfigStartModel = OPCSampleGrpConfigStartModelFactory.CreateOPCSampleGrpConfigStartModel01(); string sortCol = string.Empty; string sortingOrder = string.Empty; List <EtyDataLogDPGroupTrend> list = oPCSampleGrpConfigStartModel.GetAllOPCSampelGrp(sortCol, sortingOrder); #region PostConditionCheck Assert.AreEqual(0, list.Count); #endregion sortCol = OPCSampleGrpConfigStart.OPCSAMPLEGRPDESC_COL_NAME; sortingOrder = OPCSampleGrpConfigStart.OPCSAMPLEGRP_SORT_ASC; list = oPCSampleGrpConfigStartModel.GetAllOPCSampelGrp(sortCol, sortingOrder); #region PostConditionCheck //Assert.Greater(0, list.Count); #endregion }
public void TestDeleteOPCSampleGrp01() { OPCSampleGrpConfigStartModel oPCSampleGrpConfigStartModel = OPCSampleGrpConfigStartModelFactory.CreateOPCSampleGrpConfigStartModel01(); //insert Test Sample Group EtyDataLogDPGroupTrend etySampleGrp = new EtyDataLogDPGroupTrend(); etySampleGrp.NewData = true; etySampleGrp.SampleGrpName = "DOTTestParasoftTesting123"; etySampleGrp.Interval = 1; etySampleGrp.IntervalType = "M"; etySampleGrp.Disabled = false; oPCSampleGrpConfigStartModel.InsertOPCSampleGrp(etySampleGrp); List <EtyDataLogDPGroupTrend> list = oPCSampleGrpConfigStartModel.GetAllOPCSampelGrp(OPCSampleGrpConfigStart.OPCSAMPLEGRPDESC_COL_NAME, OPCSampleGrpConfigStart.OPCSAMPLEGRP_SORT_ASC); foreach (var item in list) { if (item.SampleGrpName.Equals("DOTTestParasoftTesting123")) { etySampleGrp = item; break; } } //Test Procedure CALL bool b = oPCSampleGrpConfigStartModel.DeleteOPCSampleGrp(etySampleGrp.SampleGrpID.ToString()); //Post Condition Check #region PostConditionCheck list = oPCSampleGrpConfigStartModel.GetAllOPCSampelGrp(OPCSampleGrpConfigStart.OPCSAMPLEGRPDESC_COL_NAME, OPCSampleGrpConfigStart.OPCSAMPLEGRP_SORT_ASC); bool BFound = false; if (list.Count > 0) { foreach (var item in list) { if (item.SampleGrpName.Equals("DOTTestParasoftTesting123")) { BFound = true; break; } } } //Assert.IsFalse(BFound); #endregion }
public void TestGetOPCGrpCount01() { OPCSampleGrpConfigStartModel oPCSampleGrpConfigStartModel = OPCSampleGrpConfigStartModelFactory.CreateOPCSampleGrpConfigStartModel01(); //Test Procedure CALL int i = oPCSampleGrpConfigStartModel.GetOPCGrpCount(); //Post Condition Check #region PostConditionCheck //check in DB directly /*int count = 0; * Accessor DBAccessor = ReflectionAccessor.Wrap(DBConnection.getInstance()); * OracleConnection dbConn = (OracleConnection) DBAccessor.Call("getConn"); * try * { * string localSQL = "SELECT COUNT(*) FROM OPC_DT_SAMPLE_GRP"; * * OracleDataReader drOracle = DBConnection.getInstance().ExecuteOracleQuery(localSQL, dbConn); * * if (drOracle != null && drOracle.Read()) * { * if (!drOracle.IsDBNull(0)) * { * count = drOracle.GetOracleDecimal(0).ToInt32(); * } * } * * if (drOracle != null) * { * drOracle.Close(); * drOracle.Dispose(); * } * } * catch (Exception localException) * { * * } * Assert.AreEqual(count, i); * */ #endregion }