void _lightControlManager_On_ReceivedData(object sender, object receiveMessage) { //解析 receiveMessage var model = CCSReceiveDataResolver.Resolve((string)receiveMessage); if (model.Intensity != "") { var onOff = model.OnOff == LightSwitch.On ? true : false; int intensity; Int32.TryParse(model.Intensity, out intensity); _lock = true; switch (model.Channel) { case "00": L1CheckBox.Checked = onOff; numericUpDown1.Value = intensity; break; case "01": L2CheckBox.Checked = onOff; numericUpDown2.Value = intensity; break; case "02": L3CheckBox.Checked = onOff; numericUpDown3.Value = intensity; break; } _lock = false; } }
public void ResolveTest(string message, string expectedStatus) { //act var model = CCSReceiveDataResolver.Resolve(message); System.Diagnostics.Debug.WriteLine("channel :" + model.Channel); System.Diagnostics.Debug.WriteLine("intensity :" + model.Intensity); System.Diagnostics.Debug.WriteLine("lightmodel :" + model.LightMode); System.Diagnostics.Debug.WriteLine("onOff :" + model.OnOff); System.Diagnostics.Debug.WriteLine("status :" + model.Status); //assert Assert.True(model.Status == expectedStatus); }