aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorBob Arnson <bob@firegiant.com>2019-05-14 14:19:34 -0400
committerBob Arnson <bob@firegiant.com>2019-05-14 16:07:39 -0400
commit44fb31d655bc5860d45e3acd4cd0cbfaaf5f12eb (patch)
treec522b10288ceacf89ae3febc692ba92f27a6b2d7 /src/test
parent83b04241472fdc93b0a3a7511479a1182ad5f4c0 (diff)
downloadwix-44fb31d655bc5860d45e3acd4cd0cbfaaf5f12eb.tar.gz
wix-44fb31d655bc5860d45e3acd4cd0cbfaaf5f12eb.tar.bz2
wix-44fb31d655bc5860d45e3acd4cd0cbfaaf5f12eb.zip
Add Component/@Shared and fix UninstallWhenSuperseded
Diffstat (limited to 'src/test')
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs39
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/SingleFile/PackageComponents.wxs17
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/WixiplFixture.cs2
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/WixlibFixture.cs2
4 files changed, 50 insertions, 10 deletions
diff --git a/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs b/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs
index 3e66ad0a..0aabc5a9 100644
--- a/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs
+++ b/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs
@@ -43,7 +43,7 @@ namespace WixToolsetTest.CoreIntegration
43 var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"test.wir")); 43 var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"test.wir"));
44 var section = intermediate.Sections.Single(); 44 var section = intermediate.Sections.Single();
45 45
46 var wixFile = section.Tuples.OfType<WixFileTuple>().Single(); 46 var wixFile = section.Tuples.OfType<WixFileTuple>().First();
47 Assert.Equal(Path.Combine(folder, @"data\test.txt"), wixFile[WixFileTupleFields.Source].AsPath().Path); 47 Assert.Equal(Path.Combine(folder, @"data\test.txt"), wixFile[WixFileTupleFields.Source].AsPath().Path);
48 Assert.Equal(@"test.txt", wixFile[WixFileTupleFields.Source].PreviousValue.AsPath().Path); 48 Assert.Equal(@"test.txt", wixFile[WixFileTupleFields.Source].PreviousValue.AsPath().Path);
49 } 49 }
@@ -540,6 +540,43 @@ namespace WixToolsetTest.CoreIntegration
540 } 540 }
541 541
542 [Fact] 542 [Fact]
543 public void CanBuildSharedComponent()
544 {
545 var folder = TestData.Get(@"TestData\SingleFile");
546
547 using (var fs = new DisposableFileSystem())
548 {
549 var baseFolder = fs.GetFolder();
550 var intermediateFolder = Path.Combine(baseFolder, "obj");
551
552 var result = WixRunner.Execute(new[]
553 {
554 "build",
555 Path.Combine(folder, "Package.wxs"),
556 Path.Combine(folder, "PackageComponents.wxs"),
557 "-loc", Path.Combine(folder, "Package.en-us.wxl"),
558 "-bindpath", Path.Combine(folder, "data"),
559 "-intermediateFolder", intermediateFolder,
560 "-arch", "x64",
561 "-o", Path.Combine(baseFolder, @"bin\test.msi")
562 });
563
564 result.AssertSuccess();
565
566 var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"test.wir"));
567 var section = intermediate.Sections.Single();
568
569 // Only one component is shared.
570 var sharedComponentTuples = section.Tuples.OfType<ComponentTuple>();
571 Assert.Equal(1, sharedComponentTuples.Sum(t => t.Shared ? 1 : 0));
572
573 // And it is this one.
574 var sharedComponentTuple = sharedComponentTuples.Single(t => t.Id.Id == "Shared.dll");
575 Assert.True(sharedComponentTuple.Shared);
576 }
577 }
578
579 [Fact]
543 public void CanBuildSetProperty() 580 public void CanBuildSetProperty()
544 { 581 {
545 var folder = TestData.Get(@"TestData\SetProperty"); 582 var folder = TestData.Get(@"TestData\SetProperty");
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/SingleFile/PackageComponents.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/SingleFile/PackageComponents.wxs
index e26c4509..b8e9f59c 100644
--- a/src/test/WixToolsetTest.CoreIntegration/TestData/SingleFile/PackageComponents.wxs
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/SingleFile/PackageComponents.wxs
@@ -1,10 +1,13 @@
1<?xml version="1.0" encoding="utf-8"?> 1<?xml version="1.0" encoding="utf-8"?>
2<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> 2<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 <Fragment> 3 <Fragment>
4 <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> 4 <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
5 <Component> 5 <Component>
6 <File Source="test.txt" /> 6 <File Source="test.txt" />
7 </Component> 7 </Component>
8 </ComponentGroup> 8 <Component Id="Shared.dll" Shared="yes">
9 </Fragment> 9 <File Name="Shared.dll" Source="test.txt" />
10 </Component>
11 </ComponentGroup>
12 </Fragment>
10</Wix> 13</Wix>
diff --git a/src/test/WixToolsetTest.CoreIntegration/WixiplFixture.cs b/src/test/WixToolsetTest.CoreIntegration/WixiplFixture.cs
index c52fa68f..391b7021 100644
--- a/src/test/WixToolsetTest.CoreIntegration/WixiplFixture.cs
+++ b/src/test/WixToolsetTest.CoreIntegration/WixiplFixture.cs
@@ -50,7 +50,7 @@ namespace WixToolsetTest.CoreIntegration
50 var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"obj\test.wir")); 50 var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"obj\test.wir"));
51 var section = intermediate.Sections.Single(); 51 var section = intermediate.Sections.Single();
52 52
53 var wixFile = section.Tuples.OfType<WixFileTuple>().Single(); 53 var wixFile = section.Tuples.OfType<WixFileTuple>().First();
54 Assert.Equal(Path.Combine(folder, @"data\test.txt"), wixFile[WixFileTupleFields.Source].AsPath().Path); 54 Assert.Equal(Path.Combine(folder, @"data\test.txt"), wixFile[WixFileTupleFields.Source].AsPath().Path);
55 Assert.Equal(@"test.txt", wixFile[WixFileTupleFields.Source].PreviousValue.AsPath().Path); 55 Assert.Equal(@"test.txt", wixFile[WixFileTupleFields.Source].PreviousValue.AsPath().Path);
56 } 56 }
diff --git a/src/test/WixToolsetTest.CoreIntegration/WixlibFixture.cs b/src/test/WixToolsetTest.CoreIntegration/WixlibFixture.cs
index 532f158d..07044a1f 100644
--- a/src/test/WixToolsetTest.CoreIntegration/WixlibFixture.cs
+++ b/src/test/WixToolsetTest.CoreIntegration/WixlibFixture.cs
@@ -50,7 +50,7 @@ namespace WixToolsetTest.CoreIntegration
50 var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"obj\test.wir")); 50 var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"obj\test.wir"));
51 var section = intermediate.Sections.Single(); 51 var section = intermediate.Sections.Single();
52 52
53 var wixFile = section.Tuples.OfType<WixFileTuple>().Single(); 53 var wixFile = section.Tuples.OfType<WixFileTuple>().First();
54 Assert.Equal(Path.Combine(folder, @"data\test.txt"), wixFile[WixFileTupleFields.Source].AsPath().Path); 54 Assert.Equal(Path.Combine(folder, @"data\test.txt"), wixFile[WixFileTupleFields.Source].AsPath().Path);
55 Assert.Equal(@"test.txt", wixFile[WixFileTupleFields.Source].PreviousValue.AsPath().Path); 55 Assert.Equal(@"test.txt", wixFile[WixFileTupleFields.Source].PreviousValue.AsPath().Path);
56 } 56 }