public void WixInternetShortcut_InstallFailure() { string sourceFile = Path.Combine(WixInternetShortcutTests.TestDataDirectory, @"product_fail.wxs"); string msiFile = Builder.BuildPackage(sourceFile, "test.msi", "WixUtilExtension"); MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.ERROR_INSTALL_FAILURE); string desktopPath = string.Format(@"{0}\Users\Public\Desktop", Environment.ExpandEnvironmentVariables(@"%SystemDrive%")); string secretLinksPath = string.Format(@"{0}\WiX Sample\Secret Links", Environment.ExpandEnvironmentVariables(@"%ProgramFiles%")); string programMenuPath = string.Format(@"{0}\ProgramData\Microsoft\Windows\Start Menu\Programs", Environment.ExpandEnvironmentVariables(@"%SystemDrive%")); string link1Location = Path.Combine(desktopPath, "Joy of Setup.lnk"); string link2Location = Path.Combine(secretLinksPath, "InternetShortcuts announcement.lnk"); string link3Location = Path.Combine(programMenuPath, "Aaron Stebner WebLog.lnk"); string link4Location = Path.Combine(programMenuPath, "Heath Stewart's Blog.lnk"); string link5Location = Path.Combine(programMenuPath, "Peter Marcu's Blog.lnk"); string link6Location = Path.Combine(programMenuPath, "Rob Mensching Openly Uninstalled.lnk"); string link7Location = Path.Combine(programMenuPath, "Setup Sense and Sensibility.lnk"); string link8Location = Path.Combine(programMenuPath, "votive, wix, vsip, and all things microsoft.lnk"); string link9Location = Path.Combine(programMenuPath, "Windows Installer Team Blog.url"); string link10Location = Path.Combine(programMenuPath, "ARP.url"); // Verify that the Internet short cuts were removed Assert.False(WixInternetShortcutTests.InterNetShortCutExists(link1Location), String.Format("Shortcut '{0}' was not removed on Rollback.", link1Location)); Assert.False(WixInternetShortcutTests.InterNetShortCutExists(link2Location), String.Format("Shortcut '{0}' was not removed on Rollback.", link2Location)); Assert.False(WixInternetShortcutTests.InterNetShortCutExists(link3Location), String.Format("Shortcut '{0}' was not removed on Rollback.", link3Location)); Assert.False(WixInternetShortcutTests.InterNetShortCutExists(link4Location), String.Format("Shortcut '{0}' was not removed on Rollback.", link4Location)); Assert.False(WixInternetShortcutTests.InterNetShortCutExists(link5Location), String.Format("Shortcut '{0}' was not removed on Rollback.", link5Location)); Assert.False(WixInternetShortcutTests.InterNetShortCutExists(link6Location), String.Format("Shortcut '{0}' was not removed on Rollback.", link6Location)); Assert.False(WixInternetShortcutTests.InterNetShortCutExists(link7Location), String.Format("Shortcut '{0}' was not removed on Rollback.", link7Location)); Assert.False(WixInternetShortcutTests.InterNetShortCutExists(link8Location), String.Format("Shortcut '{0}' was not removed on Rollback.", link8Location)); Assert.False(WixInternetShortcutTests.InterNetShortCutExists(link9Location), String.Format("Shortcut '{0}' was not removed on Rollback.", link9Location)); Assert.False(WixInternetShortcutTests.InterNetShortCutExists(link10Location), String.Format("Shortcut '{0}' was not removed on Rollback.", link10Location)); }
public void WixInternetShortcut_Install_64bit() { string sourceFile = Path.Combine(WixInternetShortcutTests.TestDataDirectory, @"product_64.wxs"); string msiFile = Builder.BuildPackage(sourceFile, "test.msi", "WixUtilExtension"); MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); string link1Location = Path.Combine(Environment.ExpandEnvironmentVariables(@"%ProgramW6432%\WiX Sample"), "notepad.lnk"); string link1Target = Environment.ExpandEnvironmentVariables(@"%SystemDrive%\Windows\System32\notepad.exe"); string link2Location = Path.Combine(Environment.ExpandEnvironmentVariables(@"%ProgramW6432%\WiX Sample"), "notepad2.url"); string link2Target = Environment.ExpandEnvironmentVariables("file:///%SystemDrive%/Windows/system32/notepad.exe"); // Verify that the Internet short cuts were created Assert.True(WixInternetShortcutTests.InterNetShortCutExists(link1Location), String.Format("Shortcut '{0}' was not created on Install.", link1Location)); Assert.True(WixInternetShortcutTests.InterNetShortCutExists(link2Location), String.Format("Shortcut '{0}' was not created on Install.", link2Location)); // verify the shortcuts have the right targets WixInternetShortcutTests.VerifyInterNetShortCutTarget(link1Location, link1Target, LinkType.Link); WixInternetShortcutTests.VerifyInterNetShortCutTarget(link2Location, link2Target, LinkType.URL); MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Verify that the Internet short cuts were removed Assert.False(WixInternetShortcutTests.InterNetShortCutExists(link1Location), String.Format("Shortcut '{0}' was not removed on Uninstall.", link1Location)); Assert.False(WixInternetShortcutTests.InterNetShortCutExists(link2Location), String.Format("Shortcut '{0}' was not removed on Uninstall.", link2Location)); }
public void WixInternetShortcut_Install() { string sourceFile = Path.Combine(WixInternetShortcutTests.TestDataDirectory, @"product.wxs"); string msiFile = Builder.BuildPackage(sourceFile, "test.msi", "WixUtilExtension"); MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); string desktopPath = string.Format(@"{0}\Users\Public\Desktop", Environment.ExpandEnvironmentVariables(@"%SystemDrive%")); string secretLinksPath = string.Format(@"{0}\WiX Sample\Secret Links", Environment.ExpandEnvironmentVariables(@"%ProgramFiles%")); string programMenuPath = string.Format(@"{0}\ProgramData\Microsoft\Windows\Start Menu\Programs", Environment.ExpandEnvironmentVariables(@"%SystemDrive%")); string link1Location = Path.Combine(desktopPath, "Joy of Setup.lnk"); string link2Location = Path.Combine(secretLinksPath, "InternetShortcuts announcement.lnk"); string link3Location = Path.Combine(programMenuPath, "Aaron Stebner WebLog.lnk"); string link4Location = Path.Combine(programMenuPath, "Heath Stewart's Blog.lnk"); string link5Location = Path.Combine(programMenuPath, "Peter Marcu's Blog.lnk"); string link6Location = Path.Combine(programMenuPath, "Rob Mensching Openly Uninstalled.lnk"); string link7Location = Path.Combine(programMenuPath, "Setup Sense and Sensibility.lnk"); string link8Location = Path.Combine(programMenuPath, "votive, wix, vsip, and all things microsoft.lnk"); string link9Location = Path.Combine(programMenuPath, "Windows Installer Team Blog.url"); string link10Location = Path.Combine(programMenuPath, "ARP.url"); // Verify that the Internet short cuts were created Assert.True(WixInternetShortcutTests.InterNetShortCutExists(link1Location), String.Format("Shortcut '{0}' was not created on Install.", link1Location)); Assert.True(WixInternetShortcutTests.InterNetShortCutExists(link2Location), String.Format("Shortcut '{0}' was not created on Install.", link2Location)); Assert.True(WixInternetShortcutTests.InterNetShortCutExists(link3Location), String.Format("Shortcut '{0}' was not created on Install.", link3Location)); Assert.True(WixInternetShortcutTests.InterNetShortCutExists(link4Location), String.Format("Shortcut '{0}' was not created on Install.", link4Location)); Assert.True(WixInternetShortcutTests.InterNetShortCutExists(link5Location), String.Format("Shortcut '{0}' was not created on Install.", link5Location)); Assert.True(WixInternetShortcutTests.InterNetShortCutExists(link6Location), String.Format("Shortcut '{0}' was not created on Install.", link6Location)); Assert.True(WixInternetShortcutTests.InterNetShortCutExists(link7Location), String.Format("Shortcut '{0}' was not created on Install.", link7Location)); Assert.True(WixInternetShortcutTests.InterNetShortCutExists(link8Location), String.Format("Shortcut '{0}' was not created on Install.", link8Location)); Assert.True(WixInternetShortcutTests.InterNetShortCutExists(link9Location), String.Format("Shortcut '{0}' was not created on Install.", link9Location)); Assert.True(WixInternetShortcutTests.InterNetShortCutExists(link10Location), String.Format("Shortcut '{0}' was not created on Install.", link10Location)); // verify the shortcuts have the right targets WixInternetShortcutTests.VerifyInterNetShortCutTarget(link9Location, "http://blogs.msdn.com/windows_installer_team/default.aspx", LinkType.URL); WixInternetShortcutTests.VerifyInterNetShortCutTarget(link10Location, Environment.ExpandEnvironmentVariables(@"file:///%SystemDrive%/Windows/Help/addremov.chm"), LinkType.URL); MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS); // Verify that the Internet short cuts were removed Assert.False(WixInternetShortcutTests.InterNetShortCutExists(link1Location), String.Format("Shortcut '{0}' was not removed on Uninstall.", link1Location)); Assert.False(WixInternetShortcutTests.InterNetShortCutExists(link2Location), String.Format("Shortcut '{0}' was not removed on Uninstall.", link2Location)); Assert.False(WixInternetShortcutTests.InterNetShortCutExists(link3Location), String.Format("Shortcut '{0}' was not removed on Uninstall.", link3Location)); Assert.False(WixInternetShortcutTests.InterNetShortCutExists(link4Location), String.Format("Shortcut '{0}' was not removed on Uninstall.", link4Location)); Assert.False(WixInternetShortcutTests.InterNetShortCutExists(link5Location), String.Format("Shortcut '{0}' was not removed on Uninstall.", link5Location)); Assert.False(WixInternetShortcutTests.InterNetShortCutExists(link6Location), String.Format("Shortcut '{0}' was not removed on Uninstall.", link6Location)); Assert.False(WixInternetShortcutTests.InterNetShortCutExists(link7Location), String.Format("Shortcut '{0}' was not removed on Uninstall.", link7Location)); Assert.False(WixInternetShortcutTests.InterNetShortCutExists(link8Location), String.Format("Shortcut '{0}' was not removed on Uninstall.", link8Location)); Assert.False(WixInternetShortcutTests.InterNetShortCutExists(link9Location), String.Format("Shortcut '{0}' was not removed on Uninstall.", link9Location)); Assert.False(WixInternetShortcutTests.InterNetShortCutExists(link10Location), String.Format("Shortcut '{0}' was not removed on Uninstall.", link10Location)); }