public void ServiceConfig_Repair() { string sourceFile = Path.Combine(ServiceConfigTests.TestDataDirectory, @"product.wxs"); string msiFile = Builder.BuildPackage(sourceFile, "test.msi", "WixUtilExtension"); MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Change the service details ServiceFailureActionType[] expectedFailureActions = new ServiceFailureActionType[] { ServiceFailureActionType.RestartService, ServiceFailureActionType.RestartService, ServiceFailureActionType.RestartService }; ServiceVerifier.SetServiceInformation("MynewService", 4, expectedFailureActions); MSIExec.RepairProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Validate Existing Service Information. expectedFailureActions = new ServiceFailureActionType[] { ServiceFailureActionType.RestartService, ServiceFailureActionType.RebootComputer, ServiceFailureActionType.None }; ServiceVerifier.VerifyServiceInformation("W32Time", 1, expectedFailureActions); // Validate New Service Information. expectedFailureActions = new ServiceFailureActionType[] { ServiceFailureActionType.RebootComputer, ServiceFailureActionType.RestartService, ServiceFailureActionType.None }; ServiceVerifier.VerifyServiceInformation("MynewService", 3, expectedFailureActions); MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Validate New Service Does NOT exist any more. Assert.False(ServiceVerifier.ServiceExists("MynewService"), String.Format("Service '{0}' was NOT removed on Uninstall.", "MynewService")); }
public void SqlString_ReInstall() { string sourceFile = Path.Combine(SqlStringTests.TestDataDirectory, @"product.wxs"); string msiFile = Builder.BuildPackage(sourceFile, "test.msi", "WixSqlExtension"); MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); Assert.IsTrue(SqlVerifier.DatabaseExists(SqlStringTests.SQLServerHostName, SqlStringTests.SQLServerInstanceName, "BlankDB15"), "Database '{0}' was not created on Install", "BlankDB15"); Assert.IsTrue(SqlVerifier.TableExists(SqlStringTests.SQLServerHostName, SqlStringTests.SQLServerInstanceName, "BlankDB15", "TestTable1"), "Table '{0}:{1}' was not created on Install", "BlankDB15", "TestTable1"); // insert a record in the new database string sqlInsertString = "INSERT INTO TestTable1(name, value) Values('test', 'nooverwrite')"; SqlVerifier.ExecuteSQlCommand(SqlStringTests.SQLServerHostName, SqlStringTests.SQLServerInstanceName, "BlankDB15", sqlInsertString); string sqlqueryString = "Select * from TestTable1 where name ='test' and value ='nooverwrite'"; Assert.IsTrue(SqlVerifier.SqlObjectExists(SqlStringTests.SQLServerHostName, SqlStringTests.SQLServerInstanceName, "BlankDB15", sqlqueryString), "Query '{0}' Results were not created on Install", sqlqueryString); MSIExec.RepairProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // verify the change is still in the database Assert.IsTrue(SqlVerifier.SqlObjectExists(SqlStringTests.SQLServerHostName, SqlStringTests.SQLServerInstanceName, "BlankDB15", sqlqueryString), "Query '{0}' Results were not created on Install", sqlqueryString); MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); SqlStringTests.DropDatabase("BlankDB10"); }
public void SqlString_Install() { string sourceFile = Path.Combine(SqlStringTests.TestDataDirectory, @"product.wxs"); string msiFile = Builder.BuildPackage(sourceFile, "test.msi", "WixSqlExtension"); MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); Assert.IsTrue(SqlVerifier.DatabaseExists(SqlStringTests.SQLServerHostName, SqlStringTests.SQLServerInstanceName, "BlankDB10"), "Database '{0}' was not created on Install", "BlankDB10"); Assert.IsTrue(SqlVerifier.TableExists(SqlStringTests.SQLServerHostName, SqlStringTests.SQLServerInstanceName, "ScottDB22", "TestTable1"), "Table '{0}:{1}' was not created on Install", "ScottDB22", "TestTable1"); Assert.IsTrue(SqlVerifier.TableExists(SqlStringTests.SQLServerHostName, SqlStringTests.SQLServerInstanceName, "BlankDB10", "TestTable2"), "Table '{0}:{1}' was not created on Install", "BlankDB10", "TestTable2"); string sqlQuery = "Select * from TestTable2 where name ='FIRST' and value ='Kurtzeborn'"; Assert.IsTrue(SqlVerifier.SqlObjectExists(SqlStringTests.SQLServerHostName, SqlStringTests.SQLServerInstanceName, "BlankDB10", sqlQuery), "Query '{0}' Results were not created on Install", sqlQuery); // Verify The Database BlankDB4 was not created Assert.IsFalse(SqlVerifier.DatabaseExists(SqlStringTests.SQLServerHostName, SqlStringTests.SQLServerInstanceName, "BlankDB44"), "Database '{0}' was created on Install", "BlankDB44"); MSIExec.RepairProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Verify The Database was added Assert.IsTrue(SqlVerifier.DatabaseExists(SqlStringTests.SQLServerHostName, SqlStringTests.SQLServerInstanceName, "BlankDB44"), "Database '{0}' was Not created on Repair", "BlankDB44"); MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); Assert.IsTrue(SqlVerifier.DatabaseExists(SqlStringTests.SQLServerHostName, SqlStringTests.SQLServerInstanceName, "BlankDB10"), "Database '{0}' was dropped on Uninstall", "BlankDB10"); Assert.IsFalse(SqlVerifier.DatabaseExists(SqlStringTests.SQLServerHostName, SqlStringTests.SQLServerInstanceName, "BlankDB44"), "Database '{0}' was not dropped on Uninstall", "BlankDB44"); SqlStringTests.DropDatabase("BlankDB10"); }
public void User_Repair() { string sourceFile = Path.Combine(UserTests.TestDataDirectory, @"product.wxs"); string msiFile = Builder.BuildPackage(sourceFile, "test.msi", "WixUtilExtension"); MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); UserVerifier.DeleteLocalUser("testName1"); UserVerifier.SetUserInformation(string.Empty, "testName2", true, false, false); MSIExec.RepairProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Validate New User Information. UserVerifier.VerifyUserInformation(string.Empty, "testName1", true, false, false); UserVerifier.VerifyUserIsMemberOf(string.Empty, "testName1", "Administrators", "Power Users"); UserVerifier.VerifyUserInformation(string.Empty, "testName2", true, true, true); UserVerifier.VerifyUserIsMemberOf(string.Empty, "testName2", "Power Users"); UserVerifier.VerifyUserIsMemberOf(Environment.GetEnvironmentVariable("tempdomain"), Environment.GetEnvironmentVariable("tempusername"), "Power Users"); MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Verify Users marked as RemoveOnUninstall were removed. Assert.IsFalse(UserVerifier.UserExists(string.Empty, "testName1"), "User '{0}' was not removed on Uninstall", "testName1"); Assert.IsTrue(UserVerifier.UserExists(string.Empty, "testName2"), "User '{0}' was removed on Uninstall", "testName2"); // clean up UserVerifier.DeleteLocalUser("testName2"); UserVerifier.VerifyUserIsNotMemberOf(Environment.GetEnvironmentVariable("tempdomain"), Environment.GetEnvironmentVariable("tempusername"), "Power Users"); }
public void PermissionEx_Repair() { string sourceFile = Path.Combine(PermissionExTests.TestDataDirectory, @"product.wxs"); string msiFile = Builder.BuildPackage(sourceFile, "test.msi", "WixUtilExtension"); MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Change File Permessions string fileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), @"WixTestFolder\MynewService.exe"); PermissionsVerifier.RemoveFilePermession(@"BUILTIN\Guests", fileName); PermissionsVerifier.RemoveFilePermession(@"Everyone", fileName); PermissionsVerifier.RemoveFilePermession(@"NT AUTHORITY\LOCAL SERVICE", fileName); // Change Folder Permessions string folderName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), @"WixTestFolder\Create Folder"); PermissionsVerifier.RemoveFolderPermession(@"Everyone", folderName); PermissionsVerifier.RemoveFolderPermession(@"BUILTIN\Guests", folderName); // Change Registry Permessions PermissionsVerifier.RemoveRegistryKeyPermission(@"BUILTIN\Guests", Microsoft.Win32.Registry.LocalMachine, @"SOFTWARE\Microsoft\Office\Delivery\MynewService"); // Change Service Permessions // TODO: Change Service permissions MSIExec.RepairProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Verify File Permessions PermissionsVerifier.VerifyFilePermession(@"BUILTIN\Guests", fileName, FileSystemRights.FullControl); PermissionsVerifier.VerifyFilePermession(@"Everyone", fileName, FileSystemRights.FullControl); PermissionsVerifier.VerifyFilePermession(@"NT AUTHORITY\LOCAL SERVICE", fileName, FileSystemRights.FullControl); // Verify Folder Permessions PermissionsVerifier.VerifyFolderPermession(@"Everyone", folderName, FileSystemRights.ReadAttributes | FileSystemRights.WriteAttributes | FileSystemRights.ChangePermissions | FileSystemRights.Synchronize); PermissionsVerifier.VerifyFolderPermession(@"BUILTIN\Guests", folderName, FileSystemRights.ReadAttributes); // Verify Registry Permessions PermissionsVerifier.VerifyRegistryKeyPermission(@"BUILTIN\Guests", Microsoft.Win32.Registry.LocalMachine, @"SOFTWARE\Microsoft\Office\Delivery\MynewService", RegistryRights.QueryValues | RegistryRights.SetValue | RegistryRights.CreateSubKey | RegistryRights.EnumerateSubKeys | RegistryRights.Notify | RegistryRights.CreateLink); // Verify Service Permessions // TODO: Check for Service permissions MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); }