Beispiel #1
0
        static ValueConvertor()
        {
            _convertorHandler = new Dictionary <string, Func <string, object> >(12)
            {
                { typeof(string).Name, (valueStr) => valueStr },
                { typeof(int).Name, (valueStr) => int.Parse(valueStr) },
                { typeof(uint).Name, (valueStr) => uint.Parse(valueStr) },
                { typeof(short).Name, (valueStr) => short.Parse(valueStr) },
                { typeof(ushort).Name, (valueStr) => ushort.Parse(valueStr) },
                { typeof(long).Name, (valueStr) => long.Parse(valueStr) },
                { typeof(ulong).Name, (valueStr) => ulong.Parse(valueStr) },
                { typeof(double).Name, (valueStr) => double.Parse(valueStr) },
                { typeof(byte).Name, (valueStr) => byte.Parse(valueStr) },
                { typeof(char).Name, (valueStr) => char.Parse(valueStr) },
                { typeof(bool).Name, (valueStr) => bool.Parse(valueStr) },
                { typeof(DateTime).Name, (valueStr) => DateTime.Parse(valueStr) }
            };

            #region 记录
            IComInterfaceManager     _interfaceManager = TestflowRunner.GetInstance().ComInterfaceManager;
            IComInterfaceDescription comDescription    = _interfaceManager.GetComInterfaceByName("mscorlib");
            _valueTypes = new HashSet <ITypeData>();
            _valueTypes.Add(comDescription.VariableTypes.FirstOrDefault(item => item.Name.Equals("Boolean")));
            _valueTypes.Add(comDescription.VariableTypes.FirstOrDefault(item => item.Name.Equals("Double")));
            _valueTypes.Add(comDescription.VariableTypes.FirstOrDefault(item => item.Name.Equals("Single")));
            _valueTypes.Add(comDescription.VariableTypes.FirstOrDefault(item => item.Name.Equals("Int64")));
            _valueTypes.Add(comDescription.VariableTypes.FirstOrDefault(item => item.Name.Equals("UInt64")));
            _valueTypes.Add(comDescription.VariableTypes.FirstOrDefault(item => item.Name.Equals("Int32")));
            _valueTypes.Add(comDescription.VariableTypes.FirstOrDefault(item => item.Name.Equals("Int16")));
            _valueTypes.Add(comDescription.VariableTypes.FirstOrDefault(item => item.Name.Equals("UInt16")));
            _valueTypes.Add(comDescription.VariableTypes.FirstOrDefault(item => item.Name.Equals("Char")));
            _valueTypes.Add(comDescription.VariableTypes.FirstOrDefault(item => item.Name.Equals("Byte")));
            _valueTypes.Add(comDescription.VariableTypes.FirstOrDefault(item => item.Name.Equals("String")));
            #endregion
        }
        public DescriptionManagerTest()
        {
            Type runnerType = typeof(TestflowRunner);
            TestflowRunnerOptions option             = new TestflowRunnerOptions();
            FakeTestflowRunner    fakeTestflowRunner = new FakeTestflowRunner(option);
            FieldInfo             fieldInfo          = runnerType.GetField("_runnerInst", BindingFlags.Static | BindingFlags.NonPublic);

            fieldInfo.SetValue(null, fakeTestflowRunner);
            fakeTestflowRunner.Initialize();

            _interfaceManager = fakeTestflowRunner.ComInterfaceManager;
            _interfaceManager.DesigntimeInitialize();
        }
Beispiel #3
0
        static TypeChecker()
        {
            IComInterfaceManager     _interfaceManager = TestflowRunner.GetInstance().ComInterfaceManager;
            IComInterfaceDescription comDescription    = _interfaceManager.GetComInterfaceByName("mscorlib");

            _valueTypes = new HashSet <ITypeData>();
            _valueTypes.Add(comDescription.VariableTypes.FirstOrDefault(item => item.Name.Equals("Boolean")));
            _valueTypes.Add(comDescription.VariableTypes.FirstOrDefault(item => item.Name.Equals("Double")));
            _valueTypes.Add(comDescription.VariableTypes.FirstOrDefault(item => item.Name.Equals("Single")));
            _valueTypes.Add(comDescription.VariableTypes.FirstOrDefault(item => item.Name.Equals("Int64")));
            _valueTypes.Add(comDescription.VariableTypes.FirstOrDefault(item => item.Name.Equals("UInt64")));
            _valueTypes.Add(comDescription.VariableTypes.FirstOrDefault(item => item.Name.Equals("Int32")));
            _valueTypes.Add(comDescription.VariableTypes.FirstOrDefault(item => item.Name.Equals("Int16")));
            _valueTypes.Add(comDescription.VariableTypes.FirstOrDefault(item => item.Name.Equals("UInt16")));
            _valueTypes.Add(comDescription.VariableTypes.FirstOrDefault(item => item.Name.Equals("Char")));
            _valueTypes.Add(comDescription.VariableTypes.FirstOrDefault(item => item.Name.Equals("Byte")));
            _valueTypes.Add(comDescription.VariableTypes.FirstOrDefault(item => item.Name.Equals("String")));
        }
Beispiel #4
0
        public ParameterCheckerTest()
        {
            #region 创建并初始化假的TestFlowRunner
            Type runnerType = typeof(TestflowRunner);
            //默认options
            TestflowRunnerOptions option = new TestflowRunnerOptions();
            //创建假的TestFlowRunner
            FakeTestflowRunner fakeTestflowRunner = new FakeTestflowRunner(option);
            Type intType = typeof(int);
            //用反射将获取private fieldInfo,然后赋值fake
            FieldInfo fieldInfo = runnerType.GetField("_runnerInst", BindingFlags.Static | BindingFlags.NonPublic);
            fieldInfo.SetValue(null, fakeTestflowRunner);
            fakeTestflowRunner.Initialize();
            #endregion

            _parameterChecker = fakeTestflowRunner.ParameterChecker;
            _sequenceManager  = fakeTestflowRunner.SequenceManager;
            _interfaceManager = fakeTestflowRunner.ComInterfaceManager;
        }
Beispiel #5
0
        public SequenceCreator()
        {
            TestflowRunner testflowRunner = TestflowRunner.GetInstance();

            _sequenceManager = testflowRunner.SequenceManager;
            IComInterfaceManager interfaceManager = testflowRunner.ComInterfaceManager;

            Type   testClassType = typeof(CoreTestClass);
            string location      = testClassType.Assembly.Location;
            IComInterfaceDescription interfaceDescription = interfaceManager.GetComponentInterface(location);

            Type intType = typeof(int);

            _intTypeData = interfaceManager.GetTypeByName(intType.Name, intType.Namespace);

            Type testCallBackType = typeof(CallBackClass);

            //同一个程序集,不需要再一次加载component
            //location = testClassType.Assembly.Location;
            //interfaceDescription = interfaceManager.GetComponentInterface(location);

            _testClassTypeData    = interfaceManager.GetTypeByName(testClassType.Name, testClassType.Namespace);
            _testCallBackTypeData = interfaceManager.GetTypeByName(testCallBackType.Name, testCallBackType.Namespace);
        }
Beispiel #6
0
        public TypeMaintainer()
        {
            TestflowRunner testflowRunner = TestflowRunner.GetInstance();

            _comInterfaceManager = testflowRunner.ComInterfaceManager;
        }