diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2019-01-19 13:03:02 -0600 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2019-01-19 13:08:19 -0600 |
commit | 985ba427f8cd12b7b74d62f83a8b304764e6077b (patch) | |
tree | a1e7aec475299134b9b77191bc6885e961c4a045 /src/test | |
parent | dcfc3e2e369958d58dc070e3dbb8992e147b7a05 (diff) | |
download | wix-985ba427f8cd12b7b74d62f83a8b304764e6077b.tar.gz wix-985ba427f8cd12b7b74d62f83a8b304764e6077b.tar.bz2 wix-985ba427f8cd12b7b74d62f83a8b304764e6077b.zip |
Integrate into latest v4
Diffstat (limited to 'src/test')
6 files changed, 110 insertions, 0 deletions
diff --git a/src/test/WixToolsetTest.PowerShell/PowerShellExtensionFixture.cs b/src/test/WixToolsetTest.PowerShell/PowerShellExtensionFixture.cs new file mode 100644 index 00000000..b2f27ecf --- /dev/null +++ b/src/test/WixToolsetTest.PowerShell/PowerShellExtensionFixture.cs | |||
@@ -0,0 +1,26 @@ | |||
1 | // 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. | ||
2 | |||
3 | namespace WixToolsetTest.PowerShell | ||
4 | { | ||
5 | using WixBuildTools.TestSupport; | ||
6 | using WixToolset.Core.TestPackage; | ||
7 | using WixToolset.PowerShell; | ||
8 | using Xunit; | ||
9 | |||
10 | public class PowerShellExtensionFixture | ||
11 | { | ||
12 | [Fact] | ||
13 | public void CantBuildUsingTypesFileWithoutSnapIn() | ||
14 | { | ||
15 | var folder = TestData.Get(@"TestData\TypesFile"); | ||
16 | var build = new Builder(folder, typeof(PowerShellExtensionFactory), new[] { folder }); | ||
17 | |||
18 | WixRunnerResult wixRunnerResult = null; | ||
19 | var results = build.BuildAndQuery(args => { | ||
20 | wixRunnerResult = WixRunner.Execute(args); | ||
21 | }); | ||
22 | Assert.NotNull(wixRunnerResult); | ||
23 | Assert.Equal((int)PSErrors.Ids.NeitherIdSpecified, wixRunnerResult.ExitCode); | ||
24 | } | ||
25 | } | ||
26 | } | ||
diff --git a/src/test/WixToolsetTest.PowerShell/TestData/TypesFile/Package.en-us.wxl b/src/test/WixToolsetTest.PowerShell/TestData/TypesFile/Package.en-us.wxl new file mode 100644 index 00000000..38c12ac1 --- /dev/null +++ b/src/test/WixToolsetTest.PowerShell/TestData/TypesFile/Package.en-us.wxl | |||
@@ -0,0 +1,11 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | |||
3 | <!-- | ||
4 | This file contains the declaration of all the localizable strings. | ||
5 | --> | ||
6 | <WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="en-US"> | ||
7 | |||
8 | <String Id="DowngradeError">A newer version of [ProductName] is already installed.</String> | ||
9 | <String Id="FeatureTitle">MsiPackage</String> | ||
10 | |||
11 | </WixLocalization> | ||
diff --git a/src/test/WixToolsetTest.PowerShell/TestData/TypesFile/Package.wxs b/src/test/WixToolsetTest.PowerShell/TestData/TypesFile/Package.wxs new file mode 100644 index 00000000..cdc323ec --- /dev/null +++ b/src/test/WixToolsetTest.PowerShell/TestData/TypesFile/Package.wxs | |||
@@ -0,0 +1,21 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
3 | <Product Id="*" Name="MsiPackage" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a"> | ||
4 | <Package InstallerVersion="200" Compressed="no" InstallScope="perMachine" /> | ||
5 | |||
6 | <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" /> | ||
7 | <MediaTemplate /> | ||
8 | |||
9 | <Feature Id="ProductFeature" Title="!(loc.FeatureTitle)"> | ||
10 | <ComponentGroupRef Id="ProductComponents" /> | ||
11 | </Feature> | ||
12 | </Product> | ||
13 | |||
14 | <Fragment> | ||
15 | <Directory Id="TARGETDIR" Name="SourceDir"> | ||
16 | <Directory Id="ProgramFilesFolder"> | ||
17 | <Directory Id="INSTALLFOLDER" Name="MsiPackage" /> | ||
18 | </Directory> | ||
19 | </Directory> | ||
20 | </Fragment> | ||
21 | </Wix> | ||
diff --git a/src/test/WixToolsetTest.PowerShell/TestData/TypesFile/PackageComponents.wxs b/src/test/WixToolsetTest.PowerShell/TestData/TypesFile/PackageComponents.wxs new file mode 100644 index 00000000..049f9a51 --- /dev/null +++ b/src/test/WixToolsetTest.PowerShell/TestData/TypesFile/PackageComponents.wxs | |||
@@ -0,0 +1,13 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" | ||
3 | xmlns:powershell="http://wixtoolset.org/schemas/v4/wxs/powershell"> | ||
4 | <Fragment> | ||
5 | <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> | ||
6 | <Component> | ||
7 | <File Source="example.txt"> | ||
8 | <powershell:TypesFile /> | ||
9 | </File> | ||
10 | </Component> | ||
11 | </ComponentGroup> | ||
12 | </Fragment> | ||
13 | </Wix> | ||
diff --git a/src/test/WixToolsetTest.PowerShell/TestData/TypesFile/example.txt b/src/test/WixToolsetTest.PowerShell/TestData/TypesFile/example.txt new file mode 100644 index 00000000..1b4ffe8a --- /dev/null +++ b/src/test/WixToolsetTest.PowerShell/TestData/TypesFile/example.txt | |||
@@ -0,0 +1 @@ | |||
This is example.txt. \ No newline at end of file | |||
diff --git a/src/test/WixToolsetTest.PowerShell/WixToolsetTest.Powershell.csproj b/src/test/WixToolsetTest.PowerShell/WixToolsetTest.Powershell.csproj new file mode 100644 index 00000000..0b5dfac4 --- /dev/null +++ b/src/test/WixToolsetTest.PowerShell/WixToolsetTest.Powershell.csproj | |||
@@ -0,0 +1,38 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | |||
4 | <Project Sdk="Microsoft.NET.Sdk"> | ||
5 | <PropertyGroup> | ||
6 | <TargetFramework>netcoreapp2.1</TargetFramework> | ||
7 | <IsPackable>false</IsPackable> | ||
8 | </PropertyGroup> | ||
9 | |||
10 | <PropertyGroup> | ||
11 | <NoWarn>NU1701</NoWarn> | ||
12 | </PropertyGroup> | ||
13 | |||
14 | <ItemGroup> | ||
15 | <Content Include="TestData\TypesFile\example.txt" CopyToOutputDirectory="PreserveNewest" /> | ||
16 | <Content Include="TestData\TypesFile\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> | ||
17 | <Content Include="TestData\TypesFile\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> | ||
18 | <Content Include="TestData\TypesFile\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" /> | ||
19 | </ItemGroup> | ||
20 | |||
21 | <ItemGroup> | ||
22 | <ProjectReference Include="..\..\wixext\WixToolset.Powershell.wixext.csproj" /> | ||
23 | </ItemGroup> | ||
24 | |||
25 | <ItemGroup> | ||
26 | <PackageReference Include="WixToolset.Core.TestPackage" Version="4.0.*" PrivateAssets="all" /> | ||
27 | </ItemGroup> | ||
28 | |||
29 | <ItemGroup> | ||
30 | <PackageReference Include="WixBuildTools.TestSupport" Version="4.0.*" /> | ||
31 | </ItemGroup> | ||
32 | |||
33 | <ItemGroup> | ||
34 | <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" /> | ||
35 | <PackageReference Include="xunit" Version="2.4.0" /> | ||
36 | <PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" /> | ||
37 | </ItemGroup> | ||
38 | </Project> | ||