コード例 #1
0
        public void Connect()
        {
            Reset();
            var manager = new SerialDeviceManager(portName);

            manager.DeviceEvent.Subscribe(OnDeviceManagerEvent);
            try
            {
                manager.Connect();
                Assert.AreEqual(OTPDeviceState.Connected, lastState);
                Assert.IsNull(lastException);
            }
            finally
            {
                try { manager.Dispose(); }
                catch (Exception) { }
            }
        }
コード例 #2
0
        public void Connect_WrongPort()
        {
            Reset();
            var manager = new SerialDeviceManager("deadbeef");

            manager.DeviceEvent.Subscribe(OnDeviceManagerEvent);
            try
            {
                Assert.Throws(typeof(System.IO.IOException), manager.Connect);
                Assert.AreEqual(OTPDeviceState.Failed, lastState);
                Assert.IsInstanceOf(typeof(System.IO.IOException), lastException);
            }
            finally
            {
                try { manager.Dispose(); }
                catch (Exception) { }
            }
        }