@joebigelow / wix / commits / cdf4cdf8

Add patch error test to validate missing baseline patch file

Rob Mensching committed Sep 23, 2022 at 17:59 UTC cdf4cdf88fd411ae6c67eea8e2b0cbb7f0cecb4c
2 files changed +36
src/wix/test/WixToolsetTest.CoreIntegration/PatchFixture.cs
+22
@@ -372,6 +372,28 @@ namespace WixToolsetTest.CoreIntegration
372 }
373 }
374
375 + [Fact]
376 + public void CannotBuildPatchWithMissingBaseline()
377 + {
378 + var sourceFolder = TestData.Get(@"TestData", "PatchWithMissingBaseline");
379 +
380 + using (var fs = new DisposableFileSystem())
381 + {
382 + var baseFolder = fs.GetFolder();
383 + var tempFolderPatch = Path.Combine(baseFolder, "patch");
384 + var templateBaselineFolder = Path.GetDirectoryName(this.templateBaselinePdb);
385 + var templateUpdateFolder = Path.GetDirectoryName(this.templateUpdatePdb);
386 +
387 + var result = BuildMspForResult("Patch1.msp", sourceFolder, tempFolderPatch, "1.0.1", bindpaths: new[] { templateBaselineFolder, templateUpdateFolder });
388 +
389 + var messages = result.Messages.Select(m => m.ToString().Replace(tempFolderPatch, "<tempFolderPatch>").Replace(templateBaselineFolder, "<templateBaselineFolder>").Replace(templateUpdateFolder, "<templateUpdateFolder>")).ToArray();
390 + WixAssert.CompareLineByLine(new[]
391 + {
392 + @"The system cannot find the file 'Missing.wixpdb' with type 'WixPatchBaseline'. The following paths were checked: Missing.wixpdb, <tempFolderPatch>\bin\Missing.wixpdb, <templateBaselineFolder>\Missing.wixpdb, <templateUpdateFolder>\Missing.wixpdb",
393 + }, messages);
394 + }
395 + }
396 +
397 private static string BuildMsi(string outputName, string sourceFolder, string baseFolder, string defineV, string defineA, string defineB, IEnumerable<string> bindpaths = null)
398 {
399 var extensionPath = Path.GetFullPath(new Uri(typeof(ExampleExtensionFactory).Assembly.CodeBase).LocalPath);
src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithMissingBaseline/Patch.wxs new
+14
@@ -0,0 +1,14 @@
1 +<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>
2 + <Patch
3 + AllowRemoval="yes"
4 + DisplayName="~Test Patch v$(V)"
5 + Description="~Test Small Update Patch v$(V)"
6 + MoreInfoURL="http://www.example.com/"
7 + Manufacturer="Example Corporation"
8 + Classification="Update">
9 +
10 + <Media Id="1" Cabinet="foo.cab">
11 + <PatchBaseline Id="RTM" BaselineFile="Missing.wixpdb" UpdateFile="Update.wixpdb" />
12 + </Media>
13 + </Patch>
14 +</Wix>