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); }
public void DeleteShare() { //---------------Set up test pack------------------- //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- var share = WindowsShare.GetShareByName("otno5553"); share.Delete(); //---------------Test Result ----------------------- }
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); }