Пример #1
0
        public void BrickUpdater_0E_00_Update_Test_002()
        {
            var Command = new Command_0E_00();

            Command.ResData    = new byte[8];
            Command.ResData[4] = 0x04;
            Command.ResData[5] = 0x05;
            Command.ResData[6] = 0x06;
            Command.ResData[7] = 0xFF;

            var Updater = new BrickUpdater_0E_00();
            var Brick   = Ev3Brick.GetInstance();

            Updater.Update(Command, Brick);

            Assert.AreEqual(Ev3Device.INPORT.INPORT_1, Brick.SensorDevice(0).ConnectedPort);
            Assert.AreEqual(Ev3Device.INPORT.INPORT_2, Brick.SensorDevice(1).ConnectedPort);
            Assert.AreEqual(Ev3Device.INPORT.INPORT_3, Brick.SensorDevice(2).ConnectedPort);
            Assert.AreEqual(Ev3Device.INPORT.INPORT_4, Brick.SensorDevice(3).ConnectedPort);
            Assert.AreEqual(Ev3SensorDevice.DEVICE_TYPE.SENSOR_DEVICE_COLOR,
                            Brick.SensorDevice(0).DeviceType);
            Assert.AreEqual(Ev3SensorDevice.DEVICE_TYPE.SENSOR_DEVICE_HT_NXT_ACCEL,
                            Brick.SensorDevice(1).DeviceType);
            Assert.AreEqual(Ev3SensorDevice.DEVICE_TYPE.SENSOR_DEVICE_NXT_TEMP,
                            Brick.SensorDevice(2).DeviceType);
            Assert.AreEqual(Ev3SensorDevice.DEVICE_TYPE.SENSOR_DEVICE_UNKNOWN,
                            Brick.SensorDevice(3).DeviceType);
            Assert.IsTrue(Brick.SensorDevice(0).IsConnected);
            Assert.IsTrue(Brick.SensorDevice(1).IsConnected);
            Assert.IsTrue(Brick.SensorDevice(2).IsConnected);
            Assert.IsFalse(Brick.SensorDevice(3).IsConnected);
        }
Пример #2
0
        public void BrickUpdater_0E_00_Update_Test_001()
        {
            var Command = new Command_0E_00();

            Command.ResData    = new byte[8];
            Command.ResData[4] = 0x00;
            Command.ResData[5] = 0x01;
            Command.ResData[6] = 0x02;
            Command.ResData[7] = 0x03;

            var Updater = new BrickUpdater_0E_00();
            var Brick   = Ev3Brick.GetInstance();

            Updater.Update(Command, Brick);

            Assert.AreEqual(Ev3Device.INPORT.INPORT_1, Brick.SensorDevice(0).ConnectedPort);
            Assert.AreEqual(Ev3Device.INPORT.INPORT_2, Brick.SensorDevice(1).ConnectedPort);
            Assert.AreEqual(Ev3Device.INPORT.INPORT_3, Brick.SensorDevice(2).ConnectedPort);
            Assert.AreEqual(Ev3Device.INPORT.INPORT_4, Brick.SensorDevice(3).ConnectedPort);
            Assert.AreEqual(Ev3SensorDevice.DEVICE_TYPE.SENSOR_DEVICE_NO_DEVICE,
                            Brick.SensorDevice(0).DeviceType);
            Assert.AreEqual(Ev3SensorDevice.DEVICE_TYPE.SENSOR_DEVICE_ULTRASONIC,
                            Brick.SensorDevice(1).DeviceType);
            Assert.AreEqual(Ev3SensorDevice.DEVICE_TYPE.SENSOR_DEVICE_GYRO,
                            Brick.SensorDevice(2).DeviceType);
            Assert.AreEqual(Ev3SensorDevice.DEVICE_TYPE.SENSOR_DEVICE_TOUCH,
                            Brick.SensorDevice(3).DeviceType);
            Assert.IsFalse(Brick.SensorDevice(0).IsConnected);
            Assert.IsTrue(Brick.SensorDevice(1).IsConnected);
            Assert.IsTrue(Brick.SensorDevice(2).IsConnected);
            Assert.IsTrue(Brick.SensorDevice(3).IsConnected);
        }