コード例 #1
0
        public static CTsGenericInstr getTsEquivFromInstr(CInstruction inst)
        {
            string typeOfStep = inst.GetType().ToString();
            logger.Debug(String.Format("Found instruction [type={0}]", typeOfStep));

            CTsGenericInstr instr = null;

            if (String.Equals(typeOfStep, typeof(CInstrPopup).FullName))
                instr = new CTsPopup(inst.data.ToString());

            if (String.Equals(typeOfStep, typeof(CInstrWait).FullName))
                instr = new CTsWait(Convert.ToInt32(inst.data));

            if (instr == null)
                instr = basicOperatorAnalyser(inst);

            if (instr != null)
            {
                instr.Skipped = inst.Skipped;
                instr.ForceFailed = inst.ForceFailed;
                instr.ForcePassed = inst.ForcePassed;
                return instr;
            }

            throw new NotImplementedException(String.Format("Data not handled : [{0}, {1}]", typeOfStep, inst.data.GetType().ToString()));
        }
コード例 #2
0
        private static CTsGenericInstr buildTtStep(CInstruction inst, CTsVariable TsVariable)
        {
            CTsGenericInstr instr = null;
            string typeOfStep = inst.GetType().ToString();
            string typeOfData = inst.data.GetType().ToString();
            CVariable variable = (CVariable)inst.data;

            if (String.Equals(typeOfStep, typeof(CInstrUnforce).FullName) && !String.Equals(typeOfData, typeof(CVariableArray).FullName))
            {
                return new CTsTtUnforce(TsVariable);
            }

            if (String.Equals(typeOfStep, typeof(CInstrForce).FullName))
            {
                return new CTsTtForce(TsVariable);
            }

            if (String.Equals(typeOfStep, typeof(CInstrTest).FullName))
            {
                return new CTsTtTest(TsVariable);
            }

            return instr;
        }
コード例 #3
0
        private static CTsGenericInstr buildCbStep(CInstruction inst, CTsVariable TsVariable)
        {
            CTsGenericInstr instr = null;
            string typeOfStep = inst.GetType().ToString();
            string typeOfData = inst.data.GetType().ToString();
            CVariable variable = (CVariable)inst.data;

            if (String.Equals(typeOfStep, typeof(CInstrUnforce).FullName))
            {
                if(String.Equals(typeOfData, typeof(CVariableArray).FullName))
                    instr = new CTsUnforceArray(TsVariable);
                else
                    instr = new CTsUnforce(TsVariable);
            }

            if (String.Equals(typeOfStep, typeof(CInstrForce).FullName))
            {
                if (String.Equals(typeOfData, typeof(CVariableBool).FullName) || String.Equals(typeOfData, typeof(CVariableInt).FullName) || String.Equals(typeOfData, typeof(CVariableUInt).FullName) || String.Equals(typeOfData, typeof(CVariableDouble).FullName))
                    instr = new CTsForce(TsVariable);

                if (String.Equals(typeOfData, typeof(CVariableArray).FullName))
                    instr = new CTsForceArray(TsVariable);
            }

            if (String.Equals(typeOfStep, typeof(CInstrTest).FullName))
            {
                if (String.Equals(typeOfData, typeof(CVariableBool).FullName) || String.Equals(typeOfData, typeof(CVariableInt).FullName) || String.Equals(typeOfData, typeof(CVariableUInt).FullName))
                    instr = new CTsTest(TsVariable);

                if (String.Equals(typeOfData, typeof(CVariableDouble).FullName))
                    instr = new CTsTestAna(TsVariable);

                if (String.Equals(typeOfData, typeof(CVariableArray).FullName))
                    instr = new CTsTestArray(TsVariable);
            }
            return instr;
        }