public void BrickDataUpdater_UpdateSensorViewModel_Test_004() { var Updater = new BrickDataUpdater(); var ViewModel = new Ev3ControllerMainViewModel(); var SensorDevice = new Ev3SensorDevice(); var Brick = Ev3Brick.GetInstance(); for (int index = 0; index < 4; index++) { ViewModel.SensorViewModelArray[index] = new Ev3SensorDeviceViewModel(); } SensorDevice.ConnectedPort = Ev3Device.INPORT.INPORT_4; SensorDevice.DeviceType = Ev3SensorDevice.DEVICE_TYPE.SENSOR_DEVICE_ULTRASONIC; SensorDevice.Value1 = 10; SensorDevice.Value2 = 11; SensorDevice.Value3 = 12; Brick.SensorDeviceArray[3] = SensorDevice; Updater.UpdateSensorViewModel(ViewModel); Assert.IsFalse(ViewModel.SensorViewModelArray[0].IsConnected); Assert.IsFalse(ViewModel.SensorViewModelArray[1].IsConnected); Assert.IsFalse(ViewModel.SensorViewModelArray[2].IsConnected); Assert.IsTrue(ViewModel.SensorViewModelArray[3].IsConnected); Assert.AreEqual("PORT_4", ViewModel.SensorViewModelArray[3].PortName); Assert.AreEqual("ULTRASONIC", ViewModel.SensorViewModelArray[3].DeviceName); Assert.AreEqual(10, ViewModel.SensorViewModelArray[3].SensorValue1); Assert.AreEqual(11, ViewModel.SensorViewModelArray[3].SensorValue2); Assert.AreEqual(12, ViewModel.SensorViewModelArray[3].SensorValue3); Assert.AreEqual("", ViewModel.SensorViewModelArray[3].SensorValue1Unit); Assert.AreEqual("", ViewModel.SensorViewModelArray[3].SensorValue2Unit); Assert.AreEqual("", ViewModel.SensorViewModelArray[3].SensorValue3Unit); }
public void Ev3SensorDevice_GetDeviceName_Test_001() { var Device = new Ev3SensorDevice(); Device.DeviceType = Ev3SensorDevice.DEVICE_TYPE.SENSOR_DEVICE_NO_DEVICE; Assert.AreEqual("NO DEVICE", Device.Device); }
public void Ev3SensorDevice_GetPortName_Test_005() { var Device = new Ev3SensorDevice(); Device.ConnectedPort = Ev3Device.INPORT.INPORT_MAX; Assert.AreEqual("", Device.Port); }
public void Ev3SensorDevice_GetDeviceName_Test_008() { var Device = new Ev3SensorDevice(); Device.DeviceType = Ev3SensorDevice.DEVICE_TYPE.SENSOR_DEVICE_MAX; Assert.AreEqual("UNKNOWN", Device.Device); }
public void Ev3SensorDevice_GetDeviceName_Test_007() { var Device = new Ev3SensorDevice(); Device.DeviceType = Ev3SensorDevice.DEVICE_TYPE.SENSOR_DEVICE_NXT_TEMP; Assert.AreEqual("TEMPERATURE", Device.Device); }
public void Ev3SensorDevice_GetDeviceName_Test_006() { var Device = new Ev3SensorDevice(); Device.DeviceType = Ev3SensorDevice.DEVICE_TYPE.SENSOR_DEVICE_HT_NXT_ACCEL; Assert.AreEqual("HTX", Device.Device); }
public void Ev3SensorDevice_GetDeviceName_Test_005() { var Device = new Ev3SensorDevice(); Device.DeviceType = Ev3SensorDevice.DEVICE_TYPE.SENSOR_DEVICE_COLOR; Assert.AreEqual("COLOR", Device.Device); }
public void Ev3SensorDevice_GetDeviceName_Test_002() { var Device = new Ev3SensorDevice(); Device.DeviceType = Ev3SensorDevice.DEVICE_TYPE.SENSOR_DEVICE_ULTRASONIC; Assert.AreEqual("ULTRASONIC", Device.Device); }
public void Ev3SensorDevice_Test() { var Device = new Ev3SensorDevice(); Assert.AreEqual("", Device.Port); Assert.AreEqual("NO DEVICE", Device.Device); Assert.AreEqual(0, Device.Value1); Assert.AreEqual(0, Device.Value2); Assert.AreEqual(0, Device.Value3); }
public void BrickDataUpdater_UpdateViewModel_Test_001() { var Updater = new BrickDataUpdater(); var ViewModel = new Ev3ControllerMainViewModel(); var MotorDevice = new Ev3MotorDevice(); var SensorDevice = new Ev3SensorDevice(); var Brick = Ev3Brick.GetInstance(); for (int index = 0; index < 4; index++) { ViewModel.MotorViewModelArray[index] = new Ev3MotorDeviceViewModel(); ViewModel.SensorViewModelArray[index] = new Ev3SensorDeviceViewModel(); } MotorDevice.ConnectedPort = Ev3Device.OUTPORT.OUTPORT_A; MotorDevice.DeviceType = Ev3MotorDevice.DEVICE_TYPE.MOTOR_DEVICE_LARGE_MOTOR; MotorDevice.Power = 10; Brick.MotorDeviceArray[0] = MotorDevice; SensorDevice.ConnectedPort = Ev3Device.INPORT.INPORT_1; SensorDevice.DeviceType = Ev3SensorDevice.DEVICE_TYPE.SENSOR_DEVICE_COLOR; SensorDevice.Value1 = 10; SensorDevice.Value2 = 11; SensorDevice.Value3 = 12; Brick.SensorDeviceArray[0] = SensorDevice; Updater.UpdateViewModel(ViewModel); Assert.IsTrue(ViewModel.MotorViewModelArray[0].IsConnected); Assert.AreEqual("PORT_A", ViewModel.MotorViewModelArray[0].PortName); Assert.AreEqual("LARGE MOTOR", ViewModel.MotorViewModelArray[0].DeviceName); Assert.AreEqual(10, ViewModel.MotorViewModelArray[0].CurrentOutput); Assert.AreEqual("%", ViewModel.MotorViewModelArray[0].CurrentOutputUnit); Assert.IsFalse(ViewModel.MotorViewModelArray[1].IsConnected); Assert.IsFalse(ViewModel.MotorViewModelArray[2].IsConnected); Assert.IsFalse(ViewModel.MotorViewModelArray[3].IsConnected); Assert.IsTrue(ViewModel.SensorViewModelArray[0].IsConnected); Assert.AreEqual("PORT_1", ViewModel.SensorViewModelArray[0].PortName); Assert.AreEqual("COLOR", ViewModel.SensorViewModelArray[0].DeviceName); Assert.AreEqual(10, ViewModel.SensorViewModelArray[0].SensorValue1); Assert.AreEqual(11, ViewModel.SensorViewModelArray[0].SensorValue2); Assert.AreEqual(12, ViewModel.SensorViewModelArray[0].SensorValue3); Assert.AreEqual("", ViewModel.SensorViewModelArray[0].SensorValue1Unit); Assert.AreEqual("", ViewModel.SensorViewModelArray[0].SensorValue2Unit); Assert.AreEqual("", ViewModel.SensorViewModelArray[0].SensorValue3Unit); Assert.IsFalse(ViewModel.SensorViewModelArray[1].IsConnected); Assert.IsFalse(ViewModel.SensorViewModelArray[2].IsConnected); Assert.IsFalse(ViewModel.SensorViewModelArray[3].IsConnected); }