public MainWindow() { InitializeComponent(); #region sizing //vb.Width = SystemParameters.WorkArea.Width; //vb.Height = SystemParameters.WorkArea.Height; #endregion #region establishing a Bluetooth connection string[] ports = PortInfoQuerier.DiscoverCOMPorts(); #region should this even be in the constructor for the main class // if no ports found, display a message and close the window if (ports.Length == 0 || ports is null) { System.Threading.Thread.Sleep(1500); MessageBox.Show ("No COM ports found, please check Bluetooth settings on your computer."); this.Close(); } else { foreach (string port in ports) { comPortList.Items.Add(port); } } #endregion // should this be in the MainWindow constructor #endregion // establishing a Bluetooth connection }
public void COMPorts_Check() { // checking to see if the program returns the COM ports that I know to be // available string[] ports = System.IO.Ports.SerialPort.GetPortNames(); Assert.AreEqual(PortInfoQuerier.DiscoverCOMPorts(), ports); }