diff options
author | Rob Mensching <rob@firegiant.com> | 2021-05-04 22:50:16 -0700 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2021-05-04 22:50:16 -0700 |
commit | e713e6695bd531d1021482d454401b86c84f3f2d (patch) | |
tree | bf76f3a6a411edd1c4b47f3a54625f7f1023e95b /src/ext/Sql/test | |
parent | 2977d0ffabcd6d68790e711736d2edd1fe0cc0af (diff) | |
download | wix-e713e6695bd531d1021482d454401b86c84f3f2d.tar.gz wix-e713e6695bd531d1021482d454401b86c84f3f2d.tar.bz2 wix-e713e6695bd531d1021482d454401b86c84f3f2d.zip |
Move Sql.wixext into ext
Diffstat (limited to 'src/ext/Sql/test')
7 files changed, 132 insertions, 0 deletions
diff --git a/src/ext/Sql/test/WixToolsetTest.Sql/SqlExtensionFixture.cs b/src/ext/Sql/test/WixToolsetTest.Sql/SqlExtensionFixture.cs new file mode 100644 index 00000000..aa9d7a1f --- /dev/null +++ b/src/ext/Sql/test/WixToolsetTest.Sql/SqlExtensionFixture.cs | |||
@@ -0,0 +1,36 @@ | |||
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.Sql | ||
4 | { | ||
5 | using System.Linq; | ||
6 | using WixBuildTools.TestSupport; | ||
7 | using WixToolset.Core.TestPackage; | ||
8 | using WixToolset.Sql; | ||
9 | using Xunit; | ||
10 | |||
11 | public class SqlExtensionFixture | ||
12 | { | ||
13 | [Fact] | ||
14 | public void CanBuildUsingSqlStuff() | ||
15 | { | ||
16 | var folder = TestData.Get(@"TestData\UsingSql"); | ||
17 | var build = new Builder(folder, typeof(SqlExtensionFactory), new[] { folder }); | ||
18 | |||
19 | var results = build.BuildAndQuery(Build, "Wix4SqlDatabase", "Wix4SqlFileSpec", "Wix4SqlScript", "Wix4SqlString"); | ||
20 | WixAssert.CompareLineByLine(new[] | ||
21 | { | ||
22 | "Wix4SqlDatabase:TestDB\tMySQLHostName\tMyInstanceName\tMyDB\tDatabaseComponent\t\tTestFileSpecId\tTestLogFileSpecId\t35", | ||
23 | "Wix4SqlFileSpec:TestFileSpecId\tTestFileSpecLogicalName\tTestFileSpec\t10MB\t100MB\t10%", | ||
24 | "Wix4SqlFileSpec:TestLogFileSpecId\tTestLogFileSpecLogicalName\tTestLogFileSpec\t1MB\t10MB\t1%", | ||
25 | "Wix4SqlScript:TestScript\tTestDB\tDatabaseComponent\tScriptBinary\t\t1\t", | ||
26 | "Wix4SqlString:TestString\tTestDB\tDatabaseComponent\tCREATE TABLE TestTable1(name varchar(20), value varchar(20))\t\t1\t", | ||
27 | }, results.ToArray()); | ||
28 | } | ||
29 | |||
30 | private static void Build(string[] args) | ||
31 | { | ||
32 | var result = WixRunner.Execute(args) | ||
33 | .AssertSuccess(); | ||
34 | } | ||
35 | } | ||
36 | } | ||
diff --git a/src/ext/Sql/test/WixToolsetTest.Sql/TestData/UsingSql/Package.en-us.wxl b/src/ext/Sql/test/WixToolsetTest.Sql/TestData/UsingSql/Package.en-us.wxl new file mode 100644 index 00000000..38c12ac1 --- /dev/null +++ b/src/ext/Sql/test/WixToolsetTest.Sql/TestData/UsingSql/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/ext/Sql/test/WixToolsetTest.Sql/TestData/UsingSql/Package.wxs b/src/ext/Sql/test/WixToolsetTest.Sql/TestData/UsingSql/Package.wxs new file mode 100644 index 00000000..ee3bc921 --- /dev/null +++ b/src/ext/Sql/test/WixToolsetTest.Sql/TestData/UsingSql/Package.wxs | |||
@@ -0,0 +1,19 @@ | |||
1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
2 | <Package Name="MsiPackage" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a" InstallerVersion="200"> | ||
3 | |||
4 | |||
5 | <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" /> | ||
6 | |||
7 | |||
8 | <Feature Id="ProductFeature" Title="!(loc.FeatureTitle)"> | ||
9 | <ComponentGroupRef Id="ProductComponents" /> | ||
10 | </Feature> | ||
11 | |||
12 | </Package> | ||
13 | |||
14 | <Fragment> | ||
15 | <StandardDirectory Id="ProgramFilesFolder"> | ||
16 | <Directory Id="INSTALLFOLDER" Name="MsiPackage" /> | ||
17 | </StandardDirectory> | ||
18 | </Fragment> | ||
19 | </Wix> | ||
diff --git a/src/ext/Sql/test/WixToolsetTest.Sql/TestData/UsingSql/PackageComponents.wxs b/src/ext/Sql/test/WixToolsetTest.Sql/TestData/UsingSql/PackageComponents.wxs new file mode 100644 index 00000000..f7626926 --- /dev/null +++ b/src/ext/Sql/test/WixToolsetTest.Sql/TestData/UsingSql/PackageComponents.wxs | |||
@@ -0,0 +1,22 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" | ||
3 | xmlns:sql="http://wixtoolset.org/schemas/v4/wxs/sql"> | ||
4 | <Fragment> | ||
5 | <Binary Id="ScriptBinary" SourceFile="example.txt" /> | ||
6 | |||
7 | <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> | ||
8 | <Component Id="DatabaseComponent" Guid="{322802E7-D65E-4C91-924F-FC6D30FEEB34}"> | ||
9 | <File Id="TestFileSpec" Source="example.txt" /> | ||
10 | <File Id="TestLogFileSpec" Source="example.txt" /> | ||
11 | |||
12 | <sql:SqlDatabase Id="TestDB" Database="MyDB" Server="MySQLHostName" Instance="MyInstanceName" CreateOnInstall="yes" DropOnUninstall="yes" ConfirmOverwrite="yes"> | ||
13 | <sql:SqlString Id="TestString" SQL="CREATE TABLE TestTable1(name varchar(20), value varchar(20))" ExecuteOnInstall="yes" /> | ||
14 | <sql:SqlFileSpec Id="TestFileSpecId" Filename="TestFileSpec" Name="TestFileSpecLogicalName" Size="10MB" GrowthSize="10%" MaxSize="100MB" /> | ||
15 | <sql:SqlLogFileSpec Id="TestLogFileSpecId" Filename="TestLogFileSpec" Name="TestLogFileSpecLogicalName" Size="1MB" GrowthSize="1%" MaxSize="10MB" /> | ||
16 | </sql:SqlDatabase> | ||
17 | |||
18 | <sql:SqlScript Id="TestScript" BinaryRef="ScriptBinary" SqlDb="TestDB" ExecuteOnInstall="yes" /> | ||
19 | </Component> | ||
20 | </ComponentGroup> | ||
21 | </Fragment> | ||
22 | </Wix> | ||
diff --git a/src/ext/Sql/test/WixToolsetTest.Sql/TestData/UsingSql/example.txt b/src/ext/Sql/test/WixToolsetTest.Sql/TestData/UsingSql/example.txt new file mode 100644 index 00000000..1b4ffe8a --- /dev/null +++ b/src/ext/Sql/test/WixToolsetTest.Sql/TestData/UsingSql/example.txt | |||
@@ -0,0 +1 @@ | |||
This is example.txt. \ No newline at end of file | |||
diff --git a/src/ext/Sql/test/WixToolsetTest.Sql/WixToolsetTest.Sql.csproj b/src/ext/Sql/test/WixToolsetTest.Sql/WixToolsetTest.Sql.csproj new file mode 100644 index 00000000..bbf3041d --- /dev/null +++ b/src/ext/Sql/test/WixToolsetTest.Sql/WixToolsetTest.Sql.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>netcoreapp3.1</TargetFramework> | ||
7 | <IsPackable>false</IsPackable> | ||
8 | </PropertyGroup> | ||
9 | |||
10 | <PropertyGroup> | ||
11 | <NoWarn>NU1701</NoWarn> | ||
12 | </PropertyGroup> | ||
13 | |||
14 | <ItemGroup> | ||
15 | <Content Include="TestData\**" CopyToOutputDirectory="PreserveNewest" /> | ||
16 | </ItemGroup> | ||
17 | |||
18 | <ItemGroup> | ||
19 | <ProjectReference Include="..\..\wixext\WixToolset.Sql.wixext.csproj" /> | ||
20 | </ItemGroup> | ||
21 | |||
22 | <ItemGroup> | ||
23 | <PackageReference Include="WixToolset.Core" Version="4.0.*" /> | ||
24 | <PackageReference Include="WixToolset.Core.Burn" Version="4.0.*" /> | ||
25 | <PackageReference Include="WixToolset.Core.WindowsInstaller" Version="4.0.*" /> | ||
26 | <PackageReference Include="WixToolset.Core.TestPackage" Version="4.0.*" /> | ||
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="16.3.0" /> | ||
35 | <PackageReference Include="xunit" Version="2.4.1" /> | ||
36 | <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" PrivateAssets="All" /> | ||
37 | </ItemGroup> | ||
38 | </Project> | ||
diff --git a/src/ext/Sql/test/WixToolsetTest.Sql/WixToolsetTest.Sql.v3.ncrunchproject b/src/ext/Sql/test/WixToolsetTest.Sql/WixToolsetTest.Sql.v3.ncrunchproject new file mode 100644 index 00000000..7b5b2139 --- /dev/null +++ b/src/ext/Sql/test/WixToolsetTest.Sql/WixToolsetTest.Sql.v3.ncrunchproject | |||
@@ -0,0 +1,5 @@ | |||
1 | <ProjectConfiguration> | ||
2 | <Settings> | ||
3 | <CopyReferencedAssembliesToWorkspace>True</CopyReferencedAssembliesToWorkspace> | ||
4 | </Settings> | ||
5 | </ProjectConfiguration> \ No newline at end of file | ||