From 64fe8bccc329ac5dc0d510bfbd73054d478ddc37 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Sat, 30 May 2020 18:55:10 +1000 Subject: Move most tests into the new WixToolsetTest.MSBuild project. This project relies on all of the projects being published in order to properly test wix.targets. --- .../MsbuildHeatFixture.cs | 155 --------------------- 1 file changed, 155 deletions(-) delete mode 100644 src/test/WixToolsetTest.BuildTasks/MsbuildHeatFixture.cs (limited to 'src/test/WixToolsetTest.BuildTasks/MsbuildHeatFixture.cs') diff --git a/src/test/WixToolsetTest.BuildTasks/MsbuildHeatFixture.cs b/src/test/WixToolsetTest.BuildTasks/MsbuildHeatFixture.cs deleted file mode 100644 index 95805658..00000000 --- a/src/test/WixToolsetTest.BuildTasks/MsbuildHeatFixture.cs +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. - -namespace WixToolsetTest.BuildTasks -{ - using System; - using System.IO; - using System.Linq; - using WixBuildTools.TestSupport; - using WixToolset.BuildTasks; - using WixToolset.Core.TestPackage; - using WixToolset.Data; - using WixToolset.Data.Tuples; - using Xunit; - - public class MsbuildHeatFixture - { - private static readonly string WixBinPath = Path.GetDirectoryName(new Uri(typeof(WixBuild).Assembly.CodeBase).AbsolutePath) + "\\"; - private static readonly string WixTargetsPath = Path.Combine(WixBinPath, "wix.targets"); - - [Fact] - public void CanBuildHeatFilePackage() - { - var projectPath = TestData.Get(@"TestData\HeatFilePackage\HeatFilePackage.wixproj"); - - using (var fs = new DisposableFileSystem()) - { - var baseFolder = fs.GetFolder(); - var binFolder = Path.Combine(baseFolder, @"bin\"); - var intermediateFolder = Path.Combine(baseFolder, @"obj\"); - - var result = MsbuildRunner.Execute(projectPath, new[] - { - $"-p:WixTargetsPath={WixTargetsPath}", - $"-p:WixBinDir={WixBinPath}", - $"-p:IntermediateOutputPath={intermediateFolder}", - $"-p:OutputPath={binFolder}" - }); - result.AssertSuccess(); - - var heatCommandLines = result.Output.Where(line => line.TrimStart().StartsWith("heat.exe file")); - Assert.Single(heatCommandLines); - - var warnings = result.Output.Where(line => line.Contains(": warning")); - Assert.Empty(warnings); - - var generatedFilePath = Path.Combine(intermediateFolder, @"_ProductComponents_INSTALLFOLDER_HeatFilePackage.wixproj_file.wxs"); - Assert.True(File.Exists(generatedFilePath)); - - var generatedContents = File.ReadAllText(generatedFilePath); - var testXml = generatedContents.GetTestXml(); - Assert.Equal(@"" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "", testXml); - - var pdbPath = Path.Combine(binFolder, "HeatFilePackage.wixpdb"); - Assert.True(File.Exists(pdbPath)); - - var intermediate = Intermediate.Load(pdbPath); - var section = intermediate.Sections.Single(); - - var fileTuple = section.Tuples.OfType().Single(); - Assert.Equal(@"SourceDir\HeatFilePackage.wixproj", fileTuple[FileTupleFields.Source].PreviousValue.AsPath().Path); - } - } - - [Fact] - public void CanBuildHeatFileWithMultipleFilesPackage() - { - var projectPath = TestData.Get(@"TestData\HeatFileMultpleFilesSameFileName\HeatFileMultpleFilesSameFileName.wixproj"); - - using (var fs = new DisposableFileSystem()) - { - var baseFolder = fs.GetFolder(); - var binFolder = Path.Combine(baseFolder, @"bin\"); - var intermediateFolder = Path.Combine(baseFolder, @"obj\"); - - var result = MsbuildRunner.Execute(projectPath, new[] - { - $"-p:WixTargetsPath={WixTargetsPath}", - $"-p:WixBinDir={WixBinPath}", - $"-p:IntermediateOutputPath={intermediateFolder}", - $"-p:OutputPath={binFolder}" - }); - result.AssertSuccess(); - - var heatCommandLines = result.Output.Where(line => line.TrimStart().StartsWith("heat.exe file")); - Assert.Equal(2, heatCommandLines.Count()); - - var warnings = result.Output.Where(line => line.Contains(": warning")); - Assert.Empty(warnings); - - var generatedFilePath = Path.Combine(intermediateFolder, @"_TxtProductComponents_INSTALLFOLDER_MyProgram.txt_file.wxs"); - Assert.True(File.Exists(generatedFilePath)); - - var generatedContents = File.ReadAllText(generatedFilePath); - var testXml = generatedContents.GetTestXml(); - Assert.Equal("" + - "" + - "" + - "" + - @"" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "", testXml); - - generatedFilePath = Path.Combine(intermediateFolder, @"_JsonProductComponents_INSTALLFOLDER_MyProgram.json_file.wxs"); - Assert.True(File.Exists(generatedFilePath)); - - generatedContents = File.ReadAllText(generatedFilePath); - testXml = generatedContents.GetTestXml(); - Assert.Equal("" + - "" + - "" + - "" + - @"" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "", testXml); - - var pdbPath = Path.Combine(binFolder, "HeatFileMultpleFilesSameFileName.wixpdb"); - Assert.True(File.Exists(pdbPath)); - - var intermediate = Intermediate.Load(pdbPath); - var section = intermediate.Sections.Single(); - - var fileTuples = section.Tuples.OfType().ToArray(); - Assert.Equal(@"SourceDir\MyProgram.txt", fileTuples[0][FileTupleFields.Source].PreviousValue.AsPath().Path); - Assert.Equal(@"SourceDir\MyProgram.json", fileTuples[1][FileTupleFields.Source].PreviousValue.AsPath().Path); - } - } - } -} -- cgit v1.2.3-55-g6feb