示例#1
0
        private string CreateTemporaryShareForFolder(string folder)
        {
            var shareName = GetRandomString(5, 10);

            WindowsShare.Create(folder, shareName, WindowsShare.ShareType.DiskDrive, 2, "Temporary share for testing", null);
            return(shareName);
        }
示例#2
0
        public void DeleteShare()
        {
            //---------------Set up test pack-------------------

            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            var share = WindowsShare.GetShareByName("otno5553");

            share.Delete();

            //---------------Test Result -----------------------
        }
示例#3
0
        public static IList <WindowsShare> GetAllShares()
        {
            IList <WindowsShare>       result = new List <WindowsShare>();
            ManagementClass            mc     = new ManagementClass("Win32_Share");
            ManagementObjectCollection moc    = mc.GetInstances();

            foreach (var o in moc)
            {
                WindowsShare share = new WindowsShare(o as ManagementObject);
                result.Add(share);
            }

            return(result);
        }