コード例 #1
0
        public bool FindMatchingRule(string testname, out string tapStep, out TestItem_Enum tapTestItem)
        {
            tapStep     = "None";
            tapTestItem = TestItem_Enum.POUT;
            bool found = false;

            foreach (var r in mr.testMappings)
            {
                switch (r.MatchRule)
                {
                default:
                case "Contains":
                    if (testname.Contains(r.Keyword))
                    {
                        tapStep     = r.TestStep;
                        tapTestItem = r.TestItem;
                        found       = true;
                        break;
                    }
                    break;
                }
            }

            return(found);
        }
コード例 #2
0
        private void SetTestPoint(ITestStep measStep, TestItem_Enum testItem, string limitHigh, string limitLow)
        {
            PropertyInfo pInfo;
            double       lowD, highD;
            string       tpType, tpField, tpLimitLowField, tpLimitHighField;

            Tuple <string, string, string, string> tpInfo;
            bool result = supportedTestPoints.TryGetValue(testItem, out tpInfo);

            if (result)
            {
                tpType           = tpInfo.Item1;
                tpField          = tpInfo.Item2;
                tpLimitLowField  = tpInfo.Item3;
                tpLimitHighField = tpInfo.Item4;
            }
            else
            {
                throw new Exception("Test Item not exist:" + testItem.ToString());
            }

            if (tpType == "System.Double")
            {
                if (!Double.TryParse(limitLow, out lowD))
                {
                    throw new InvalidDataException("Low Limit invalid!");
                }
                if (!Double.TryParse(limitHigh, out highD))
                {
                    throw new InvalidDataException("High Limit invalid!");
                }
            }
            else
            {
                throw new Exception("Test Point type is not supported:" + tpType);
            }

            if (tpField != null)
            {
                pInfo = measStep.GetType().GetProperty(tpField);
                SetProperty(measStep, pInfo, pInfo.Name, pInfo.PropertyType.FullName, "true");
            }
            pInfo = measStep.GetType().GetProperty(tpLimitLowField);
            SetProperty(measStep, pInfo, pInfo.Name, pInfo.PropertyType.FullName, limitLow);
            pInfo = measStep.GetType().GetProperty(tpLimitHighField);
            SetProperty(measStep, pInfo, pInfo.Name, pInfo.PropertyType.FullName, limitHigh);
        }