public void UseRealArch()
        {
            //controller.
            //1.从控制器接收数据
            //2.判断控制器当前设置的状态:上传或下载
            //3.得到控制器类型
            //4.加载“具体的控制器处理类”,执行数据处理,及回复66确认
            DeviceInfo8036 deviceInfo = new DeviceInfo8036();

            //1.取得当前操作的控制器数据
            SCA.BusinessLib.ModelOperation.ControllerModelOperation cModelOperation = new SCA.BusinessLib.ModelOperation.ControllerModelOperation();
            ControllerModel controllerModel = cModelOperation.GetControllersBySpecificID(1);

            //2.判断当前控制器的连接状态
            //ICom  com=Substitute.For<ICom>();
            IControllerCommunication controller = Substitute.For <IControllerCommunication>();

            controller.PortName.Returns <string>("Com1");
            controller.BaudRate.Returns <int>(38400);

            controller.OpenPort().Returns <bool>(true);             //打开端口

            controller.TestControllerStatus().Returns <bool>(true); //获取控制器状态<收到巡检命令 CA>

            //controller.
            //3.执行下传数据指令

            //controller.Received
            IControllerOperation operation = Substitute.For <IControllerOperation>();
            // operation.GetControllerType().Returns<ControllerType>(ControllerType.NT8036);
            // SCA.BusinessLib.BusinessLogic.ControllerManager controllerManager = new SCA.BusinessLib.BusinessLogic.ControllerManager();

            //  controllerManager.AddController(controllerModel.ID,operation);//一个Controller对应一个Operation
        }
Exemplo n.º 2
0
        public void TestControllerDownloadData()
        {
            
            //controller.
            //1.从控制器接收数据
            //2.判断控制器当前设置的状态:上传或下载
            //3.得到控制器类型
            //4.加载“具体的控制器处理类”,执行数据处理,及回复66确认
            IControllerCommunication controller = Substitute.For<IControllerCommunication>();
            controller.PortName.Returns<string>("Com1");
            controller.BaudRate.Returns<int>(38400);
            controller.OpenPort().Returns<bool>(true);
            //controller.Received
            IControllerOperation operation = Substitute.For<IControllerOperation>();
            operation.GetControllerType().Returns<ControllerType>(ControllerType.NT8036);
            SCA.BusinessLib.BusinessLogic.ControllerManager controllerManager = new BusinessLib.BusinessLogic.ControllerManager();

            controllerManager.AddController(1, operation);
        }