public void Help() { Lit lit = new Lit(); lit.Help = true; this.AddExpectedHelpText(lit); lit.Run(); }
public void SimpleBindPath() { // Create a temp text file to bind into the wix library DirectoryInfo tempDirectory = Directory.CreateDirectory(Utilities.FileUtilities.GetUniqueFileName()); string testFileName = Path.Combine(tempDirectory.FullName, "TextFile1.txt"); StreamWriter outputFile = File.CreateText(testFileName); outputFile.Write("abc"); outputFile.Close(); // Build the library Lit lit = new Lit(); lit.ObjectFiles.Add(Candle.Compile(Path.Combine(BindPathTests.TestDataDirectory, @"SimpleBindPath\Product.wxs"))); lit.BindPath = tempDirectory.FullName; lit.BindFiles = true; lit.Run(); // Delete the source file File.Delete(testFileName); // Link the library and verify files are in the resulting msi layout Light light = new Light(lit); light.Run(); string outputFileName = Path.Combine(Path.GetDirectoryName(lit.OutputFile), @"PFiles\WixTestFolder\TextFile1.txt"); Assert.IsTrue(File.Exists(outputFileName), "File was not created in msi layout as expected."); Assert.IsTrue(File.ReadAllText(outputFileName).Equals("abc"), "File contents do not match expected."); }
public void DefaultOutput() { Lit lit = new Lit(); lit.ObjectFiles.Add(Candle.Compile(WixTests.PropertyFragmentWxs)); lit.SetOutputFileIfNotSpecified = false; lit.OutputFile = string.Empty; lit.Run(); }
public void InvalidWixObjFile() { Lit lit = new Lit(); lit.ObjectFiles.Add(Path.Combine(InputTests.TestDataDirectory, @"InvalidWixObjFile\Library.wixobj")); lit.ExpectedWixMessages.Add(new WixMessage(104, "Not a valid object file; detail: Data at the root level is invalid. Line 1, position 1.", WixMessage.MessageTypeEnum.Error)); lit.ExpectedExitCode = 104; lit.Run(); }
public void SuppressSpecificWarnings() { Lit lit = new Lit(); lit.OtherArguments = " -abc"; lit.ObjectFiles.Add(Candle.Compile(WixTests.PropertyFragmentWxs)); lit.SuppressWarnings.Add(1098); lit.Run(); }
public void NoSuppressWarningsSwitch() { Lit lit = new Lit(); lit.OtherArguments = " -abc"; lit.ObjectFiles.Add(Candle.Compile(WixTests.PropertyFragmentWxs)); lit.ExpectedWixMessages.Add(new WixMessage(1098, "'abc' is not a valid command line argument.", WixMessage.MessageTypeEnum.Warning)); lit.Run(); }
public void MultipleWixObjFiles() { Lit lit = new Lit(); lit.ObjectFiles.Add(Candle.Compile(WixTests.PropertyFragmentWxs)); lit.ObjectFiles.Add(Candle.Compile(Path.Combine(InputTests.TestDataDirectory, @"MultipleWixObjFiles\ComponentFragment.wxs"))); lit.ObjectFiles.Add(Candle.Compile(Path.Combine(InputTests.TestDataDirectory, @"MultipleWixObjFiles\PropertyFragment.wxs"))); lit.Run(); }
public void VerifyDeprecatedSwitch() { Lit lit = new Lit(); lit.ObjectFiles.Add(Candle.Compile(WixTests.PropertyFragmentWxs)); lit.OtherArguments = "-swall"; lit.ExpectedWixMessages.Add(new WixMessage(1108, "The command line switch 'swall' is deprecated. Please use 'sw' instead.", WixMessage.MessageTypeEnum.Warning)); lit.Run(); }
public void SuppressAllWarningsSwitch() { Lit lit = new Lit(); lit.OtherArguments = " -abc"; lit.ObjectFiles.Add(Candle.Compile(WixTests.PropertyFragmentWxs)); lit.SuppressAllWarnings = true; lit.Run(); }
public void IgnoreOtherSwitches() { Lit lit = new Lit(); lit.Help = true; lit.OtherArguments = " -abc"; this.AddExpectedHelpText(lit); lit.Run(); }
public void EmptyWixObjFile() { Lit lit = new Lit(); lit.ObjectFiles.Add(Path.Combine(InputTests.TestDataDirectory, @"EmptyWixObjFile\EmptyFile.wixobj")); lit.ExpectedWixMessages.Add(new WixMessage(104, "Not a valid object file; detail: Root element is missing.", WixMessage.MessageTypeEnum.Error)); lit.ExpectedExitCode = 104; lit.Run(); }
public void SingleWxlFile() { Lit lit = new Lit(); lit.ObjectFiles.Add(Candle.Compile(WixTests.PropertyFragmentWxs)); lit.LocFiles.Add(Path.Combine(LocalizationTests.TestDataDirectory, @"Shared\en-US.wxl")); lit.Run(); Verifier.VerifyWixLibLocString(lit.OutputFile,"en-us","String1","String1(en-us)"); }
public void FileNameWithSpace() { DirectoryInfo outputDirectory = Directory.CreateDirectory(Utilities.FileUtilities.GetUniqueFileName()); Lit lit = new Lit(); lit.ObjectFiles.Add(Candle.Compile(WixTests.PropertyFragmentWxs)); lit.OutputFile = Path.Combine(outputDirectory.FullName, " Simple Fragment .wix"); lit.Run(); }
public void NonAlphaNumericCharactersInFileName() { DirectoryInfo outputDirectory = Directory.CreateDirectory(Utilities.FileUtilities.GetUniqueFileName()); Lit lit = new Lit(); lit.ObjectFiles.Add(Candle.Compile(WixTests.PropertyFragmentWxs)); lit.OutputFile = Path.Combine(outputDirectory.FullName, "~!@#$%^&()_-+=,;.wix"); lit.Run(); }
public void NoWixObjExtension() { Candle candle = new Candle(); candle.SourceFiles.Add(WixTests.PropertyFragmentWxs); candle.OutputFile = "Library"; candle.Run(); Lit lit = new Lit(candle); lit.Run(); }
public void ResponseFile() { Lit lit = new Lit(); lit.ObjectFiles.Add(Candle.Compile(WixTests.PropertyFragmentWxs)); lit.ResponseFile = Path.Combine(InputTests.TestDataDirectory, @"ResponseFile\ResponseFile.txt"); lit.Run(); // verify the loc file added by the @ResponseFile is read and added to the library Verifier.VerifyWixLibLocString(lit.OutputFile, "en-us", "String1", "String1(en-us)"); }
public void TreatSpecificWarningsAsErrorSwitch() { Lit lit = new Lit(); lit.ObjectFiles.Add(Candle.Compile(WixTests.PropertyFragmentWxs)); lit.OtherArguments = " -abc"; lit.TreatWarningsAsErrors.Add(1098); lit.ExpectedWixMessages.Add(new WixMessage(1098, "'abc' is not a valid command line argument.", WixMessage.MessageTypeEnum.Error)); lit.ExpectedExitCode = 1098; lit.Run(); }
public void DoubleQuotesInOutputFileName() { Lit lit = new Lit(); lit.ObjectFiles.Add(Candle.Compile(WixTests.PropertyFragmentWxs)); lit.OutputFile = "testfile\\\"wixobj"; lit.SetOutputFileIfNotSpecified = false; string expectedOutput = string.Format("Your file or directory path '{0}' cannot contain a quote. Quotes are often accidentally introduced when trying to refer to a directory path with spaces in it, such as \"C:\\Out Directory\\\". The correct representation for that path is: \"C:\\Out Directory\\\\\".", "testfile\"wixobj"); lit.ExpectedWixMessages.Add(new WixMessage(117, expectedOutput, WixMessage.MessageTypeEnum.Error)); lit.ExpectedExitCode = 117; lit.Run(); }
public void NonAlphaNumericCharactersInFileName() { DirectoryInfo temporaryDirectory = Directory.CreateDirectory(Utilities.FileUtilities.GetUniqueFileName()); Candle candle = new Candle(); candle.SourceFiles.Add(WixTests.PropertyFragmentWxs); candle.OutputFile = Path.Combine(temporaryDirectory.FullName, "~!@#$%^&()_-=+,.wixobj"); candle.Run(); Lit lit = new Lit(candle); lit.Run(); }
public void FileNameWithSingleQuotes() { DirectoryInfo temporaryDirectory = Directory.CreateDirectory(Utilities.FileUtilities.GetUniqueFileName()); Candle candle = new Candle(); candle.SourceFiles.Add(WixTests.PropertyFragmentWxs); candle.OutputFile = Path.Combine(temporaryDirectory.FullName, "'BasicProduct'.wixobj"); candle.Run(); Lit lit = new Lit(candle); lit.Run(); }
public void NonExistingOutputDirectory() { string outputDirectory = Utilities.FileUtilities.GetUniqueFileName(); Lit lit = new Lit(); lit.ObjectFiles.Add(Candle.Compile(WixTests.PropertyFragmentWxs)); lit.OutputFile = Path.Combine(outputDirectory, "SimpleFragment.wix"); lit.Run(); if (!File.Exists(Path.Combine(outputDirectory, "SimpleFragment.wix"))) { Assert.True(false, "failed to create output directory specified in -out swith of lit"); } }
public void MultipleWixlibs() { // Create Temp Directory string outputDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); Utilities.FileUtilities.CreateOutputDirectory(outputDirectory); // Build first Wix object Candle candle1 = new Candle(); candle1.SourceFiles.Add(Path.Combine(WixlibTests.TestDataDirectory, "MultipleWixlibs\\Product.wxs")); candle1.OutputFile = Path.Combine(outputDirectory,"Product.wixobj"); // candle1.OutputToTemp = false; candle1.Run(); String firstObjectFile = candle1.OutputFile; // Build first wixlib Lit lit1 = new Lit(candle1); lit1.OutputFile = Path.Combine(outputDirectory, "Product.wixlib"); lit1.Run(); String firstWixlib = lit1.ExpectedOutputFile; // Build Second Wix object Candle candle2 = new Candle(); candle2.SourceFiles.Add(Path.Combine(WixlibTests.TestDataDirectory, "MultipleWixlibs\\Component.wxs")); candle2.OutputFile = Path.Combine(outputDirectory,"Component.wixobj"); // candle2.OutputToTemp = false; candle2.Run(); String secondObjectFile = candle2.OutputFile; // Build second wixlib Lit lit2 = new Lit(candle2); lit2.OutputFile = Path.Combine(outputDirectory, "Component.wixlib"); lit2.Run(); String secondWixlib = lit2.ExpectedOutputFile; // Generate Expected msi directly from wix objects Light light1 = new Light(); light1.ObjectFiles.Add(firstObjectFile); light1.ObjectFiles.Add(secondObjectFile); light1.OutputFile = Path.Combine(outputDirectory, "ExpectedProduct.msi"); light1.Run(); String expectedMSI = light1.OutputFile; // Generate msi from the lib objects Light light2 = new Light(); light2.ObjectFiles.Add(firstWixlib); light2.ObjectFiles.Add(secondWixlib); light2.OutputFile = Path.Combine(outputDirectory, "actual.msi"); light2.Run(); Verifier.VerifyResults(expectedMSI, light2.OutputFile); }
public void FileNameWithSpace() { Candle candle = new Candle(); candle.SourceFiles.Add(WixTests.PropertyFragmentWxs); candle.Run(); string testdirectoryName = Utilities.FileUtilities.GetUniqueFileName(); Directory.CreateDirectory(testdirectoryName); string testFile = Path.Combine(testdirectoryName, " Simple Fragment .wixobj"); File.Copy(candle.OutputFile, testFile); Lit lit = new Lit(); lit.ObjectFiles.Add(testFile); lit.Run(); }
public void LongFilePath() { DirectoryInfo tempDirectory = Directory.CreateDirectory(Utilities.FileUtilities.GetUniqueFileName()); string longFileName = FileSystemTests.GetRandomString(256); Lit lit = new Lit(); lit.ObjectFiles.Add(Candle.Compile(WixTests.PropertyFragmentWxs)); lit.OutputFile = tempDirectory.FullName +Path.DirectorySeparatorChar+ longFileName; lit.SetOutputFileIfNotSpecified = false; // avoid error with the long filename string errorMessage = string.Format("Invalid file name specified on the command line: '{0}'. Error message: 'The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.'", lit.OutputFile); lit.ExpectedWixMessages.Add(new WixMessage(284, errorMessage, WixMessage.MessageTypeEnum.Error)); lit.ExpectedExitCode = 284; lit.Run(); }
public void InvalidOutputFileName() { string[] invalidFileNames = new string[] { "testfile>wixobj", "testfile<wixobj", "testfile?wixobj", "testfile|wixobj", "testfile*wixobj" }; string inputFile = Candle.Compile(WixTests.PropertyFragmentWxs); Lit lit; foreach (string invalidFileName in invalidFileNames) { lit = new Lit(); lit.ObjectFiles.Add(inputFile); lit.OutputFile = invalidFileName; lit.SetOutputFileIfNotSpecified = false; string expectedOutput = string.Format("Invalid file name specified on the command line: '{0}'. Error message: 'Illegal characters in path.'", invalidFileName); lit.ExpectedWixMessages.Add(new WixMessage(284, expectedOutput, WixMessage.MessageTypeEnum.Error)); lit.ExpectedExitCode = 284; lit.Run(); } }
public void OutSwitch() { DirectoryInfo outputDirectory = Directory.CreateDirectory(Utilities.FileUtilities.GetUniqueFileName()); Lit lit = new Lit(); lit.ObjectFiles.Add(Candle.Compile(WixTests.PropertyFragmentWxs)); lit.OutputFile = Path.Combine(outputDirectory.FullName, "SimpleFragment.wix"); ; lit.Run(); if (! File .Exists (Path.Combine(outputDirectory.FullName, "SimpleFragment.wix"))) { Assert.True(false, "failed to handle -out swith of lit"); } }
public void SingleWixlib() { Candle candle = new Candle(); candle.SourceFiles.Add(WixTests.BasicProductWxs); candle.Run(); //Building the expected msi directly from wixobj Light light1 = new Light(); light1.ObjectFiles.Add(candle.OutputFile); light1.Run(); String expectedMSI = light1.OutputFile; // Build a wixlib Lit lit = new Lit(candle); lit.Run(); Light light2 = new Light(); light2.ObjectFiles.Add(lit.ExpectedOutputFile); light2.Run(); Verifier.VerifyResults(expectedMSI, light2.OutputFile); }
public void SingleWixObjFile() { string testFile = Candle.Compile(WixTests.PropertyFragmentWxs); Lit lit = new Lit(); lit.ObjectFiles.Add(testFile); lit.Run(); }
public void ValidFileWithUnknownExtension() { Candle candle = new Candle(); candle.SourceFiles.Add(WixTests.PropertyFragmentWxs); candle.OutputFile = "Library.foo"; candle.Run(); Lit lit = new Lit(candle); lit.Run(); }
public void WildcardInput() { Candle candle = new Candle(); candle.SourceFiles.Add(Path.Combine(InputTests.TestDataDirectory, @"WildcardInput\PropertyFragment1.wxs")); candle.SourceFiles.Add(Path.Combine(InputTests.TestDataDirectory, @"WildcardInput\PropertyFragment2.wxs")); candle.SourceFiles.Add(Path.Combine(InputTests.TestDataDirectory, @"WildcardInput\TestPropertyFragment3.wxs")); candle.SourceFiles.Add(Path.Combine(InputTests.TestDataDirectory, @"WildcardInput\TestPropertyFragment4.wxs")); candle.Run(); Lit lit = new Lit(); lit.ObjectFiles.Add(Path.Combine(Path.GetDirectoryName(candle.OutputFile),@"PropertyFragment?.wixobj")); lit.ObjectFiles.Add(Path.Combine(Path.GetDirectoryName(candle.OutputFile),@"Test*.wixobj")); lit.Run(); Verifier.VerifyWixLibProperty(lit.OutputFile, "Property1", "Property1_Value"); Verifier.VerifyWixLibProperty(lit.OutputFile, "Property2", "Property2_Value"); Verifier.VerifyWixLibProperty(lit.OutputFile, "Property3", "Property3_Value"); Verifier.VerifyWixLibProperty(lit.OutputFile, "Property4", "Property4_Value"); }