diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2020-04-02 21:00:43 +1000 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2020-04-02 21:34:24 +1000 |
commit | 7027e259b8987e425362ee8248e5d0efe8003d51 (patch) | |
tree | 7745b9055aecb9817bfa51576c81dd7efc38c019 /src/test | |
parent | 177784c9a6d93eeb3c195e6d62b97eb4c1dde32b (diff) | |
download | wix-7027e259b8987e425362ee8248e5d0efe8003d51.tar.gz wix-7027e259b8987e425362ee8248e5d0efe8003d51.tar.bz2 wix-7027e259b8987e425362ee8248e5d0efe8003d51.zip |
Hide the concrete implementation of the service provider interfaces
by adding WixToolsetServiceProviderFactory.
This forces consumers to code to the interfaces.
Diffstat (limited to 'src/test')
5 files changed, 7 insertions, 6 deletions
diff --git a/src/test/Example.Extension/ExampleExtensionFactory.cs b/src/test/Example.Extension/ExampleExtensionFactory.cs index ee9641a2..e54561ee 100644 --- a/src/test/Example.Extension/ExampleExtensionFactory.cs +++ b/src/test/Example.Extension/ExampleExtensionFactory.cs | |||
@@ -4,12 +4,13 @@ namespace Example.Extension | |||
4 | { | 4 | { |
5 | using System; | 5 | using System; |
6 | using WixToolset.Extensibility; | 6 | using WixToolset.Extensibility; |
7 | using WixToolset.Extensibility.Services; | ||
7 | 8 | ||
8 | public class ExampleExtensionFactory : IExtensionFactory | 9 | public class ExampleExtensionFactory : IExtensionFactory |
9 | { | 10 | { |
10 | private ExamplePreprocessorExtensionAndCommandLine preprocessorExtension; | 11 | private ExamplePreprocessorExtensionAndCommandLine preprocessorExtension; |
11 | 12 | ||
12 | public ExampleExtensionFactory(IServiceProvider serviceProvider) | 13 | public ExampleExtensionFactory(IWixToolsetCoreServiceProvider serviceProvider) |
13 | { | 14 | { |
14 | this.ServiceProvider = serviceProvider; | 15 | this.ServiceProvider = serviceProvider; |
15 | } | 16 | } |
@@ -17,7 +18,7 @@ namespace Example.Extension | |||
17 | /// <summary> | 18 | /// <summary> |
18 | /// This exists just to show it is possible to get a service provider to the extension factory. | 19 | /// This exists just to show it is possible to get a service provider to the extension factory. |
19 | /// </summary> | 20 | /// </summary> |
20 | private IServiceProvider ServiceProvider { get; } | 21 | private IWixToolsetCoreServiceProvider ServiceProvider { get; } |
21 | 22 | ||
22 | public bool TryCreateExtension(Type extensionType, out object extension) | 23 | public bool TryCreateExtension(Type extensionType, out object extension) |
23 | { | 24 | { |
diff --git a/src/test/WixToolsetTest.CoreIntegration/LinkerFixture.cs b/src/test/WixToolsetTest.CoreIntegration/LinkerFixture.cs index 254b78f8..97e6bde9 100644 --- a/src/test/WixToolsetTest.CoreIntegration/LinkerFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/LinkerFixture.cs | |||
@@ -21,7 +21,7 @@ namespace WixToolsetTest.CoreIntegration | |||
21 | { | 21 | { |
22 | var intermediate1 = new Intermediate("TestIntermediate1", new[] { new IntermediateSection("test1", SectionType.Product, 65001) }, null); | 22 | var intermediate1 = new Intermediate("TestIntermediate1", new[] { new IntermediateSection("test1", SectionType.Product, 65001) }, null); |
23 | var intermediate2 = new Intermediate("TestIntermediate2", new[] { new IntermediateSection("test2", SectionType.Fragment, 65001) }, null); | 23 | var intermediate2 = new Intermediate("TestIntermediate2", new[] { new IntermediateSection("test2", SectionType.Fragment, 65001) }, null); |
24 | var serviceProvider = new WixToolsetServiceProvider(); | 24 | var serviceProvider = WixToolsetServiceProviderFactory.CreateServiceProvider(); |
25 | 25 | ||
26 | var listener = new TestMessageListener(); | 26 | var listener = new TestMessageListener(); |
27 | var messaging = serviceProvider.GetService<IMessaging>(); | 27 | var messaging = serviceProvider.GetService<IMessaging>(); |
diff --git a/src/test/WixToolsetTest.CoreIntegration/ParseFixture.cs b/src/test/WixToolsetTest.CoreIntegration/ParseFixture.cs index eca3aa34..afb93041 100644 --- a/src/test/WixToolsetTest.CoreIntegration/ParseFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/ParseFixture.cs | |||
@@ -15,7 +15,7 @@ namespace WixToolsetTest.CoreIntegration | |||
15 | [Fact] | 15 | [Fact] |
16 | public void GeneratesCorrectCustomActionIdentifiers() | 16 | public void GeneratesCorrectCustomActionIdentifiers() |
17 | { | 17 | { |
18 | var serviceProvider = new WixToolsetServiceProvider(); | 18 | var serviceProvider = WixToolsetServiceProviderFactory.CreateServiceProvider(); |
19 | var section = new IntermediateSection("section", SectionType.Fragment, 0); | 19 | var section = new IntermediateSection("section", SectionType.Fragment, 0); |
20 | var parseHelper = serviceProvider.GetService<IParseHelper>(); | 20 | var parseHelper = serviceProvider.GetService<IParseHelper>(); |
21 | 21 | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/PreprocessorFixture.cs b/src/test/WixToolsetTest.CoreIntegration/PreprocessorFixture.cs index 432d025a..b038812d 100644 --- a/src/test/WixToolsetTest.CoreIntegration/PreprocessorFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/PreprocessorFixture.cs | |||
@@ -21,7 +21,7 @@ namespace WixToolsetTest.CoreIntegration | |||
21 | var includeFolder = Path.Combine(folder, "data"); | 21 | var includeFolder = Path.Combine(folder, "data"); |
22 | var includeFile = Path.Combine(includeFolder, "Package.wxi"); | 22 | var includeFile = Path.Combine(includeFolder, "Package.wxi"); |
23 | 23 | ||
24 | var serviceProvider = new WixToolsetServiceProvider(); | 24 | var serviceProvider = WixToolsetServiceProviderFactory.CreateServiceProvider(); |
25 | 25 | ||
26 | var context = serviceProvider.GetService<IPreprocessContext>(); | 26 | var context = serviceProvider.GetService<IPreprocessContext>(); |
27 | context.SourcePath = sourcePath; | 27 | context.SourcePath = sourcePath; |
diff --git a/src/test/WixToolsetTest.CoreIntegration/VariableResolverFixture.cs b/src/test/WixToolsetTest.CoreIntegration/VariableResolverFixture.cs index 3443896b..28c68e99 100644 --- a/src/test/WixToolsetTest.CoreIntegration/VariableResolverFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/VariableResolverFixture.cs | |||
@@ -15,7 +15,7 @@ namespace WixToolsetTest.CoreIntegration | |||
15 | [Fact] | 15 | [Fact] |
16 | public void CanRecursivelyResolveVariables() | 16 | public void CanRecursivelyResolveVariables() |
17 | { | 17 | { |
18 | var serviceProvider = new WixToolsetServiceProvider(); | 18 | var serviceProvider = WixToolsetServiceProviderFactory.CreateServiceProvider(); |
19 | var variableResolver = serviceProvider.GetService<IVariableResolver>(); | 19 | var variableResolver = serviceProvider.GetService<IVariableResolver>(); |
20 | 20 | ||
21 | var variables = new Dictionary<string, BindVariable>() | 21 | var variables = new Dictionary<string, BindVariable>() |