diff options
Diffstat (limited to 'src/test')
6 files changed, 124 insertions, 0 deletions
diff --git a/src/test/WixToolsetTest.Util/TestData/UsingFileShare/Package.en-us.wxl b/src/test/WixToolsetTest.Util/TestData/UsingFileShare/Package.en-us.wxl new file mode 100644 index 00000000..38c12ac1 --- /dev/null +++ b/src/test/WixToolsetTest.Util/TestData/UsingFileShare/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.Util/TestData/UsingFileShare/Package.wxs b/src/test/WixToolsetTest.Util/TestData/UsingFileShare/Package.wxs new file mode 100644 index 00000000..68ff98fd --- /dev/null +++ b/src/test/WixToolsetTest.Util/TestData/UsingFileShare/Package.wxs | |||
@@ -0,0 +1,22 @@ | |||
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 | |||
13 | </Product> | ||
14 | |||
15 | <Fragment> | ||
16 | <Directory Id="TARGETDIR" Name="SourceDir"> | ||
17 | <Directory Id="ProgramFilesFolder"> | ||
18 | <Directory Id="INSTALLFOLDER" Name="MsiPackage" /> | ||
19 | </Directory> | ||
20 | </Directory> | ||
21 | </Fragment> | ||
22 | </Wix> | ||
diff --git a/src/test/WixToolsetTest.Util/TestData/UsingFileShare/PackageComponents.wxs b/src/test/WixToolsetTest.Util/TestData/UsingFileShare/PackageComponents.wxs new file mode 100644 index 00000000..c548bc1d --- /dev/null +++ b/src/test/WixToolsetTest.Util/TestData/UsingFileShare/PackageComponents.wxs | |||
@@ -0,0 +1,16 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" | ||
3 | xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"> | ||
4 | <Fragment> | ||
5 | <util:User Id="Everyone" Name="Everyone" /> | ||
6 | |||
7 | <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> | ||
8 | <Component> | ||
9 | <File Source="example.txt" /> | ||
10 | <util:FileShare Id="ExampleFileShare" Description="An example file share" Name="example"> | ||
11 | <util:FileSharePermission User="Everyone" Read="yes" /> | ||
12 | </util:FileShare> | ||
13 | </Component> | ||
14 | </ComponentGroup> | ||
15 | </Fragment> | ||
16 | </Wix> | ||
diff --git a/src/test/WixToolsetTest.Util/TestData/UsingFileShare/example.txt b/src/test/WixToolsetTest.Util/TestData/UsingFileShare/example.txt new file mode 100644 index 00000000..1b4ffe8a --- /dev/null +++ b/src/test/WixToolsetTest.Util/TestData/UsingFileShare/example.txt | |||
@@ -0,0 +1 @@ | |||
This is example.txt. \ No newline at end of file | |||
diff --git a/src/test/WixToolsetTest.Util/UtilExtensionFixture.cs b/src/test/WixToolsetTest.Util/UtilExtensionFixture.cs new file mode 100644 index 00000000..5ce9f5ea --- /dev/null +++ b/src/test/WixToolsetTest.Util/UtilExtensionFixture.cs | |||
@@ -0,0 +1,34 @@ | |||
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.VisualStudio | ||
4 | { | ||
5 | using System.Linq; | ||
6 | using WixBuildTools.TestSupport; | ||
7 | using WixToolset.Core.TestPackage; | ||
8 | using WixToolset.Util; | ||
9 | using Xunit; | ||
10 | |||
11 | public class VisualStudioExtensionFixture | ||
12 | { | ||
13 | [Fact] | ||
14 | public void CanBuildUsingFileShare() | ||
15 | { | ||
16 | var folder = TestData.Get(@"TestData\UsingFileShare"); | ||
17 | var build = new Builder(folder, typeof(UtilExtensionFactory), new[] { folder }); | ||
18 | |||
19 | var results = build.BuildAndQuery(Build, "FileShare", "FileSharePermissions"); | ||
20 | Assert.Equal(new[] | ||
21 | { | ||
22 | "FileShare:SetVS2010Vsix\t51\tVS_VSIX_INSTALLER_PATH\t[VS2010_VSIX_INSTALLER_PATH]\t0", | ||
23 | "FileSharePermissions:SetVS2012Vsix\t51\tVS_VSIX_INSTALLER_PATH\t[VS2012_VSIX_INSTALLER_PATH]\t0", | ||
24 | }, results.OrderBy(s => s).ToArray()); | ||
25 | } | ||
26 | |||
27 | private static void Build(string[] args) | ||
28 | { | ||
29 | var result = WixRunner.Execute(args, out var messages); | ||
30 | Assert.Equal(0, result); | ||
31 | Assert.Empty(messages); | ||
32 | } | ||
33 | } | ||
34 | } | ||
diff --git a/src/test/WixToolsetTest.Util/WixToolsetTest.Util.csproj b/src/test/WixToolsetTest.Util/WixToolsetTest.Util.csproj new file mode 100644 index 00000000..9559059d --- /dev/null +++ b/src/test/WixToolsetTest.Util/WixToolsetTest.Util.csproj | |||
@@ -0,0 +1,40 @@ | |||
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.0</TargetFramework> | ||
7 | <IsPackable>false</IsPackable> | ||
8 | </PropertyGroup> | ||
9 | |||
10 | <PropertyGroup> | ||
11 | <NoWarn>NU1701</NoWarn> | ||
12 | </PropertyGroup> | ||
13 | |||
14 | <ItemGroup> | ||
15 | <Content Include="TestData\UsingFileShare\example.txt" CopyToOutputDirectory="PreserveNewest" /> | ||
16 | <Content Include="TestData\UsingFileShare\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> | ||
17 | <Content Include="TestData\UsingFileShare\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> | ||
18 | <Content Include="TestData\UsingFileShare\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" /> | ||
19 | </ItemGroup> | ||
20 | |||
21 | <ItemGroup> | ||
22 | <ProjectReference Include="..\..\wixext\WixToolset.Util.wixext.csproj" /> | ||
23 | </ItemGroup> | ||
24 | |||
25 | <ItemGroup> | ||
26 | <ProjectReference Include="$(WixToolsetRootFolder)\Core\src\WixToolset.Core.TestPackage\WixToolset.Core.TestPackage.csproj" Condition=" '$(Configuration)' == 'Debug' And Exists('$(WixToolsetRootFolder)\Core\src\WixToolset.Core.TestPackage\WixToolset.Core.TestPackage.csproj') " /> | ||
27 | <ProjectReference Include="$(WixToolsetRootFolder)\Core\src\wix\wix.csproj" Condition=" '$(Configuration)' == 'Debug' And Exists('$(WixToolsetRootFolder)\Core\src\wix\wix.csproj') " /> | ||
28 | <PackageReference Include="WixToolset.Core.TestPackage" Version="4.0.*" Condition=" '$(Configuration)' == 'Release' Or !Exists('$(WixToolsetRootFolder)\Core\src\WixToolset.Core.TestPackage\WixToolset.Core.TestPackage.csproj') " PrivateAssets="all" /> | ||
29 | </ItemGroup> | ||
30 | |||
31 | <ItemGroup> | ||
32 | <PackageReference Include="WixBuildTools.TestSupport" Version="4.0.*" /> | ||
33 | </ItemGroup> | ||
34 | |||
35 | <ItemGroup> | ||
36 | <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0-preview-20170628-02" /> | ||
37 | <PackageReference Include="xunit" Version="2.2.0" /> | ||
38 | <PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" /> | ||
39 | </ItemGroup> | ||
40 | </Project> | ||