public void Ev3PortViewModel_PortConnectExecuteTest_002() { var ViewModel = new Ev3PortViewModel(); ViewModel.SelectedComPort = ComPortViewModel.Create("COM41", "Device"); ViewModel.PortConnectExecute(); Assert.AreEqual(ConnectionState.Connecting, ViewModel.ConnectState.State); Thread.Sleep(4000); Assert.AreEqual(ConnectionState.Connected, ViewModel.ConnectState.State); ViewModel.PortDisconnectExecute(); Assert.AreEqual(ConnectionState.Disconnecting, ViewModel.ConnectState.State); Thread.Sleep(3000); Assert.AreEqual(ConnectionState.Disconnected, ViewModel.ConnectState.State); Thread.Sleep(1000); ViewModel.PortConnectExecute(); Assert.AreEqual(ConnectionState.Connecting, ViewModel.ConnectState.State); Thread.Sleep(4000); Assert.AreEqual(ConnectionState.Connected, ViewModel.ConnectState.State); ViewModel.PortDisconnectExecute(); Assert.AreEqual(ConnectionState.Disconnecting, ViewModel.ConnectState.State); Thread.Sleep(3000); Assert.AreEqual(ConnectionState.Disconnected, ViewModel.ConnectState.State); }
public void Ev3PortViewModel_PortConnectExecuteTest_001() { var ViewModel = new Ev3PortViewModel(); ViewModel.SelectedComPort = ComPortViewModel.Create("COM41", "Device"); ViewModel.PortConnectExecute(); Assert.IsFalse(ViewModel.CanChangePort); Assert.AreEqual("接続", ViewModel.ActionName); Assert.AreEqual("接続中", ViewModel.StateLabel); Assert.AreEqual(ConnectionState.Connecting, ViewModel.ConnectState.State); Thread.Sleep(4000); Assert.IsTrue(ViewModel.CanChangePort); Assert.AreEqual("切断", ViewModel.ActionName); Assert.AreEqual("接続済み", ViewModel.StateLabel); Assert.AreEqual(ConnectionState.Connected, ViewModel.ConnectState.State); ViewModel.PortDisconnectExecute(); Assert.IsFalse(ViewModel.CanChangePort); Assert.AreEqual("切断", ViewModel.ActionName); Assert.AreEqual("切断中", ViewModel.StateLabel); Assert.AreEqual(ConnectionState.Disconnecting, ViewModel.ConnectState.State); Thread.Sleep(3000); Assert.IsTrue(ViewModel.CanChangePort); Assert.AreEqual("接続", ViewModel.ActionName); Assert.AreEqual("未接続", ViewModel.StateLabel); Assert.AreEqual(ConnectionState.Disconnected, ViewModel.ConnectState.State); }