public void DriveConnection()
        {
            Console.WriteLine("Network.Host.DriveConnection()");

            #region Using last available drive to share

            string share = Path.LocalToUnc(LocalHostShare);
            bool   connectOk;
            Console.WriteLine("\nUsing IDisposable class.");
            try
            {
                StopWatcher(true);
                using (var connection = new DriveConnection(share))
                {
                    Console.WriteLine("\nUsing DriveConnection(): [{0}] to: [{1}]\n\n\t{2}\n", connection.LocalName, share, Reporter(true));
                    connectOk = true;
                }
            }
            catch (Exception ex)
            {
                connectOk = false;
                Console.WriteLine("\nFailed DriveConnection() to: [{0}]", share);
                Console.WriteLine("\nCaught Exception: [{0}]", ex.Message.Replace(Environment.NewLine, "  "));
            }

            Assert.IsTrue(connectOk);

            #endregion // Using last available drive to share
        }
示例#2
0
        public void AlphaFS_Host_DriveConnection()
        {
            var share = Alphaleonis.Win32.Filesystem.Path.LocalToUnc(UnitTestConstants.LocalHostShare);

            using (var connection = new DriveConnection(share))
            {
                Console.WriteLine("\nUsing DriveConnection(): [{0}] to: [{1}]", connection.LocalName, share);

                Assert.AreEqual(share, connection.Share);
            }
        }