Ejemplo n.º 1
0
        /// <summary>
        /// To get driver from session manager
        /// </summary>
        /// <param name="SessionName">Expected session</param>
        /// <returns>Object</returns>
        protected object GetInterface(string SessionName)
        {
            string strName = string.Format("{0}_{1}", SessionName, Position);

            try
            {
                object objSession = null;
                if (true == pISessionManagement.SessionExists(SessionName, Position))
                {
                    objSession = pISessionManagement.GetSessionByName(SessionName, Position);
                }
                else
                {
                    objSession = pISessionManagement.CreateSession(SessionName, Position);
                    //throw new Exception(string.Format("Can't find {0} in SessionManager.", strName));
                }
                ICommonComponent pICC = objSession as ICommonComponent;
                if (false == pICC.IsInitialized)
                {
                    pISessionManagement.InitializeSession(SessionName, Position);
                }

                return(objSession);
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("{0}->{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, ex.Message));
            }
        }
Ejemplo n.º 2
0
        public TestClassBase(Hashtable TestParams)
        {
            Init();

            //import core data
            CoreData = TestParams;

            try
            {
                pISessionManagement = GetCoreInterface(CommonTags.CoreData_SessionManage) as ISessionManagement;
                pILog       = pISessionManagement.GetSessionByName("ILog", Position) as ILog;
                pIDataTable = GetCoreInterface(CommonTags.CoreData_DataTable) as IDataTable;

                dlgtLogSend += new delegateLogSend(pILog.OnLogReceived);
            }
            catch (Exception ex)
            {
            }
        }