diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/WixToolsetTest.CoreIntegration/PreprocessorFixture.cs | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/src/test/WixToolsetTest.CoreIntegration/PreprocessorFixture.cs b/src/test/WixToolsetTest.CoreIntegration/PreprocessorFixture.cs index f9a9fe83..633a1b46 100644 --- a/src/test/WixToolsetTest.CoreIntegration/PreprocessorFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/PreprocessorFixture.cs | |||
@@ -1,19 +1,44 @@ | |||
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. | 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 | 2 | ||
3 | namespace WixToolsetTest.CoreIntegration | 3 | namespace WixToolsetTest.CoreIntegration |
4 | { | 4 | { |
5 | using System.IO; | 5 | using System.IO; |
6 | using System.Linq; | 6 | using System.Linq; |
7 | using WixBuildTools.TestSupport; | 7 | using WixBuildTools.TestSupport; |
8 | using WixToolset.Core; | ||
8 | using WixToolset.Core.TestPackage; | 9 | using WixToolset.Core.TestPackage; |
9 | using WixToolset.Data; | 10 | using WixToolset.Extensibility.Data; |
10 | using WixToolset.Data.Tuples; | ||
11 | using WixToolset.Data.WindowsInstaller; | ||
12 | using Xunit; | 11 | using Xunit; |
13 | 12 | ||
14 | public class PreprocessorFixture | 13 | public class PreprocessorFixture |
15 | { | 14 | { |
16 | [Fact] | 15 | [Fact] |
16 | public void PreprocessDirectly() | ||
17 | { | ||
18 | var folder = TestData.Get(@"TestData\IncludePath"); | ||
19 | var sourcePath = Path.Combine(folder, "Package.wxs"); | ||
20 | var includeFolder = Path.Combine(folder, "data"); | ||
21 | var includeFile = Path.Combine(includeFolder, "Package.wxi"); | ||
22 | |||
23 | var serviceProvider = new WixToolsetServiceProvider(); | ||
24 | |||
25 | var context = (IPreprocessContext)serviceProvider.GetService(typeof(IPreprocessContext)); | ||
26 | context.SourcePath = sourcePath; | ||
27 | context.IncludeSearchPaths = new[] { includeFolder }; | ||
28 | |||
29 | var preprocessor = (IPreprocessor)serviceProvider.GetService(typeof(IPreprocessor)); | ||
30 | var result = preprocessor.Preprocess(context); | ||
31 | |||
32 | var includedFile = result.IncludedFiles.Single(); | ||
33 | Assert.NotNull(result.Document); | ||
34 | Assert.Equal(includeFile, includedFile.Path); | ||
35 | Assert.Equal(sourcePath, includedFile.SourceLineNumbers.FileName); | ||
36 | Assert.Equal(2, includedFile.SourceLineNumbers.LineNumber.Value); | ||
37 | Assert.Equal($"{sourcePath}*2", includedFile.SourceLineNumbers.QualifiedFileName); | ||
38 | Assert.Null(includedFile.SourceLineNumbers.Parent); | ||
39 | } | ||
40 | |||
41 | [Fact] | ||
17 | public void VariableRedefinitionIsAWarning() | 42 | public void VariableRedefinitionIsAWarning() |
18 | { | 43 | { |
19 | var folder = TestData.Get(@"TestData\Variables"); | 44 | var folder = TestData.Get(@"TestData\Variables"); |