public void FileShare_Install_64bit() { string sourceFile = Path.Combine(FileShareTests.TestDataDirectory, @"product_64.wxs"); string msiFile = Builder.BuildPackage(sourceFile, "test.msi", "WixUtilExtension"); MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Verify Directory Exists. string physicalTestFolderPath = Path.Combine(Environment.ExpandEnvironmentVariables(@"%ProgramW6432%"), @"WixTestFolder"); Assert.True(Directory.Exists(physicalTestFolderPath), String.Format("Test folder '{0}' was not created on Install.", physicalTestFolderPath)); // Verify Fileshare Exists. string testFolderPath = Path.Combine(@"\\" + System.Environment.MachineName, "TestShareName"); Assert.True(Directory.Exists(testFolderPath), String.Format("Share '{0}' was not created on Install.", testFolderPath)); // Verify Fileshare Permissions. PermissionsVerifier.VerifySharePermession(Environment.GetEnvironmentVariable("tempdomain") + "\\ddrelqa1", testFolderPath, PermissionsVerifier.ACCESS_MASK.READ_CONTROL | PermissionsVerifier.ACCESS_MASK.WRITE_DAC | PermissionsVerifier.ACCESS_MASK.WRITE_OWNER | PermissionsVerifier.ACCESS_MASK.DELETE); PermissionsVerifier.VerifySharePermession(Environment.GetEnvironmentVariable("tempdomain") + "\\ddrelqa2", testFolderPath, PermissionsVerifier.ACCESS_MASK.READ_CONTROL); MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Verify Fileshare is removed. Assert.False(Directory.Exists(testFolderPath), String.Format("Share '{0}' was not removed on Uninstall.", testFolderPath)); }
// bug: https://sourceforge.net/tracker/?func=detail&aid=2824407&group_id=105970&atid=642714 public void FileShare_ExistingShare() { string sourceFile = Path.Combine(FileShareTests.TestDataDirectory, @"product.wxs"); string msiFile = Builder.BuildPackage(sourceFile, "test.msi", "WixUtilExtension"); // create the share string testFolderPath = Path.Combine(@"\\" + System.Environment.MachineName, "TestShareName"); string testForderPhysicalPath = Utilities.FileUtilities.GetUniqueFileName(); Directory.CreateDirectory(testForderPhysicalPath); FileUtilities.CreateShare(testForderPhysicalPath, "TestShareName"); MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Verify Fileshare still Exists. Assert.True(Directory.Exists(testFolderPath), String.Format("Share '{0}' was not created on Install.", testFolderPath)); // Verify Fileshare Permissions. PermissionsVerifier.VerifySharePermession(Environment.GetEnvironmentVariable("tempdomain") + "\\ddrelqa1", testFolderPath, PermissionsVerifier.ACCESS_MASK.READ_CONTROL | PermissionsVerifier.ACCESS_MASK.WRITE_DAC | PermissionsVerifier.ACCESS_MASK.WRITE_OWNER | PermissionsVerifier.ACCESS_MASK.DELETE); PermissionsVerifier.VerifySharePermession(Environment.GetEnvironmentVariable("tempdomain") + "\\ddrelqa2", testFolderPath, PermissionsVerifier.ACCESS_MASK.READ_CONTROL); MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Verify Fileshare is removed. Assert.False(Directory.Exists(testFolderPath), String.Format("Share '{0}' was not removed on Uninstall.", testFolderPath)); }