public void BrickDataUpdater_UpdateMotorViewModel_Test_003() { var Updater = new BrickDataUpdater(); var ViewModel = new Ev3ControllerMainViewModel(); var MotorDevice = new Ev3MotorDevice(); var Brick = Ev3Brick.GetInstance(); for (int index = 0; index < 4; index++) { ViewModel.MotorViewModelArray[index] = new Ev3MotorDeviceViewModel(); } MotorDevice.ConnectedPort = Ev3Device.OUTPORT.OUTPORT_C; MotorDevice.DeviceType = Ev3MotorDevice.DEVICE_TYPE.MOTOR_DEVICE_LARGE_MOTOR; MotorDevice.Power = 12; Brick.MotorDeviceArray[2] = MotorDevice; Updater.UpdateMotorViewModel(ViewModel); Assert.IsFalse(ViewModel.MotorViewModelArray[0].IsConnected); Assert.IsFalse(ViewModel.MotorViewModelArray[1].IsConnected); Assert.IsTrue(ViewModel.MotorViewModelArray[2].IsConnected); Assert.AreEqual("PORT_C", ViewModel.MotorViewModelArray[2].PortName); Assert.AreEqual("LARGE MOTOR", ViewModel.MotorViewModelArray[2].DeviceName); Assert.AreEqual(12, ViewModel.MotorViewModelArray[2].CurrentOutput); Assert.AreEqual("%", ViewModel.MotorViewModelArray[2].CurrentOutputUnit); Assert.IsFalse(ViewModel.MotorViewModelArray[3].IsConnected); }
public void BrickDataUpdater_UpdateMotorViewModel_Test_010() { var Updater = new BrickDataUpdater(); var ViewModel = new Ev3ControllerMainViewModel(); var MotorDevice1 = new Ev3MotorDevice(); var MotorDevice2 = new Ev3MotorDevice(); var Brick = Ev3Brick.GetInstance(); for (int index = 0; index < 4; index++) { ViewModel.MotorViewModelArray[index] = new Ev3MotorDeviceViewModel(); } MotorDevice1.Power = 13; MotorDevice2.Power = 23; Brick.MotorDeviceArray[2] = MotorDevice1; Brick.MotorDeviceArray[3] = MotorDevice2; Updater.UpdateMotorViewModel(ViewModel); Assert.IsFalse(ViewModel.MotorViewModelArray[0].IsConnected); Assert.IsFalse(ViewModel.MotorViewModelArray[1].IsConnected); Assert.IsTrue(ViewModel.MotorViewModelArray[2].IsConnected); Assert.AreEqual(13, ViewModel.MotorViewModelArray[2].CurrentOutput); Assert.AreEqual("%", ViewModel.MotorViewModelArray[2].CurrentOutputUnit); Assert.IsTrue(ViewModel.MotorViewModelArray[3].IsConnected); Assert.AreEqual(23, ViewModel.MotorViewModelArray[3].CurrentOutput); Assert.AreEqual("%", ViewModel.MotorViewModelArray[3].CurrentOutputUnit); }