diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/test/WixToolsetTest.BuildTasks/FakeBuildEngine.cs | 14 | ||||
-rw-r--r-- | src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs | 8 |
2 files changed, 14 insertions, 8 deletions
diff --git a/src/test/WixToolsetTest.BuildTasks/FakeBuildEngine.cs b/src/test/WixToolsetTest.BuildTasks/FakeBuildEngine.cs index 0559057f..8fd69414 100644 --- a/src/test/WixToolsetTest.BuildTasks/FakeBuildEngine.cs +++ b/src/test/WixToolsetTest.BuildTasks/FakeBuildEngine.cs | |||
@@ -3,11 +3,13 @@ | |||
3 | namespace WixToolsetTest.BuildTasks | 3 | namespace WixToolsetTest.BuildTasks |
4 | { | 4 | { |
5 | using System.Collections; | 5 | using System.Collections; |
6 | using System.Diagnostics; | 6 | using System.Text; |
7 | using Microsoft.Build.Framework; | 7 | using Microsoft.Build.Framework; |
8 | 8 | ||
9 | internal class FakeBuildEngine : IBuildEngine | 9 | internal class FakeBuildEngine : IBuildEngine |
10 | { | 10 | { |
11 | private StringBuilder output = new StringBuilder(); | ||
12 | |||
11 | public int ColumnNumberOfTaskNode => 0; | 13 | public int ColumnNumberOfTaskNode => 0; |
12 | 14 | ||
13 | public bool ContinueOnError => false; | 15 | public bool ContinueOnError => false; |
@@ -16,14 +18,16 @@ namespace WixToolsetTest.BuildTasks | |||
16 | 18 | ||
17 | public string ProjectFileOfTaskNode => "fake_wix.targets"; | 19 | public string ProjectFileOfTaskNode => "fake_wix.targets"; |
18 | 20 | ||
21 | public string Output => this.output.ToString(); | ||
22 | |||
19 | public bool BuildProjectFile(string projectFileName, string[] targetNames, IDictionary globalProperties, IDictionary targetOutputs) => throw new System.NotImplementedException(); | 23 | public bool BuildProjectFile(string projectFileName, string[] targetNames, IDictionary globalProperties, IDictionary targetOutputs) => throw new System.NotImplementedException(); |
20 | 24 | ||
21 | public void LogCustomEvent(CustomBuildEventArgs e) => Debug.Write(e.Message); | 25 | public void LogCustomEvent(CustomBuildEventArgs e) => this.output.AppendLine(e.Message); |
22 | 26 | ||
23 | public void LogErrorEvent(BuildErrorEventArgs e) => Debug.Write(e.Message); | 27 | public void LogErrorEvent(BuildErrorEventArgs e) => this.output.AppendLine(e.Message); |
24 | 28 | ||
25 | public void LogMessageEvent(BuildMessageEventArgs e) => Debug.Write(e.Message); | 29 | public void LogMessageEvent(BuildMessageEventArgs e) => this.output.AppendLine(e.Message); |
26 | 30 | ||
27 | public void LogWarningEvent(BuildWarningEventArgs e) => Debug.Write(e.Message); | 31 | public void LogWarningEvent(BuildWarningEventArgs e) => this.output.AppendLine(e.Message); |
28 | } | 32 | } |
29 | } | 33 | } |
diff --git a/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs b/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs index 79975f37..a27928d5 100644 --- a/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs +++ b/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs | |||
@@ -14,7 +14,7 @@ namespace WixToolsetTest.BuildTasks | |||
14 | public partial class MsbuildFixture | 14 | public partial class MsbuildFixture |
15 | { | 15 | { |
16 | [Fact] | 16 | [Fact] |
17 | public void CanBuildSingleFile() | 17 | public void CanBuildSimpleMsiPackage() |
18 | { | 18 | { |
19 | var folder = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage"); | 19 | var folder = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage"); |
20 | 20 | ||
@@ -23,9 +23,11 @@ namespace WixToolsetTest.BuildTasks | |||
23 | var baseFolder = fs.GetFolder(); | 23 | var baseFolder = fs.GetFolder(); |
24 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | 24 | var intermediateFolder = Path.Combine(baseFolder, "obj"); |
25 | 25 | ||
26 | var engine = new FakeBuildEngine(); | ||
27 | |||
26 | var task = new DoIt | 28 | var task = new DoIt |
27 | { | 29 | { |
28 | BuildEngine = new FakeBuildEngine(), | 30 | BuildEngine = engine, |
29 | SourceFiles = new[] | 31 | SourceFiles = new[] |
30 | { | 32 | { |
31 | new TaskItem(Path.Combine(folder, "Package.wxs")), | 33 | new TaskItem(Path.Combine(folder, "Package.wxs")), |
@@ -44,7 +46,7 @@ namespace WixToolsetTest.BuildTasks | |||
44 | }; | 46 | }; |
45 | 47 | ||
46 | var result = task.Execute(); | 48 | var result = task.Execute(); |
47 | Assert.True(result, "MSBuild task failed unexpectedly."); | 49 | Assert.True(result, $"MSBuild task failed unexpectedly. Output:\r\n{engine.Output}"); |
48 | 50 | ||
49 | Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.msi"))); | 51 | Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.msi"))); |
50 | Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb"))); | 52 | Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb"))); |