public void NetworkConnectionDialogTest() { var ncd = new NetworkConnectionDialog { UseMostRecentPath = true }; Assert.That(ncd.ShowDialog(), Is.EqualTo(DialogResult.OK)); Assert.That(ncd.ConnectedDeviceCount, Is.GreaterThanOrEqualTo(0)); Assert.That(MessageBox.Show("Confirm MRU path shown", "NetworkConnectionDialog Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes); ncd.Reset(); Assert.That(ncd.UseMostRecentPath, Is.False); ncd.RemoteNetworkName = @"\\HALLAN-SVR\share"; Assert.That(() => ncd.UseMostRecentPath = true, Throws.InvalidOperationException); ncd.HideRestoreConnectionCheckBox = true; Assert.That(ncd.ShowDialog(), Is.EqualTo(DialogResult.OK)); Assert.That(MessageBox.Show("Confirm remote path shown and checkbox hidden.", "NetworkConnectionDialog Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes); }
public static bool OpenMapNetworkDriveDialog() { using var ncd = new NetworkConnectionDialog { UseMostRecentPath = true }; ncd.HideRestoreConnectionCheckBox = false; return(ncd.ShowDialog() == DialogResult.OK); }