Exemple #1
0
        public void Usb_Adapter_Writing_Reading()
        {
            if (IsRunningOnAzurePipelines)
            {
                return;
            }

            String virtualSerialDeviceName = "HHD Software Virtual Serial Port";
            String errorMessage            = "Could not locate any virtual serial port bridge. Please download from https://freevirtualserialports.com and create a local bridge.";

            var devices = UsbDevice.GetAvailableDevices();

            var virtualPort1 = devices.FirstOrDefault(x => x.Description.Contains(virtualSerialDeviceName));

            Assert.IsNotNull(virtualPort1, errorMessage);

            var virtualPort2 = devices.FirstOrDefault(x => x.Description.Contains(virtualSerialDeviceName) && x != virtualPort1);

            Assert.IsNotNull(virtualPort2, errorMessage);

            TestUtils.Read_Write_Test(
                this,
                new UsbAdapter(virtualPort1, BaudRates.BR_19200),
                new UsbAdapter(virtualPort2, BaudRates.BR_19200),
                false,
                1000,
                10);
        }