aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/Example.Extension/ExampleExtensionFactory.cs22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/test/Example.Extension/ExampleExtensionFactory.cs b/src/test/Example.Extension/ExampleExtensionFactory.cs
index a081b758..ee9641a2 100644
--- a/src/test/Example.Extension/ExampleExtensionFactory.cs
+++ b/src/test/Example.Extension/ExampleExtensionFactory.cs
@@ -1,4 +1,4 @@
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
3namespace Example.Extension 3namespace Example.Extension
4{ 4{
@@ -9,16 +9,26 @@ namespace Example.Extension
9 { 9 {
10 private ExamplePreprocessorExtensionAndCommandLine preprocessorExtension; 10 private ExamplePreprocessorExtensionAndCommandLine preprocessorExtension;
11 11
12 public ExampleExtensionFactory(IServiceProvider serviceProvider)
13 {
14 this.ServiceProvider = serviceProvider;
15 }
16
17 /// <summary>
18 /// This exists just to show it is possible to get a service provider to the extension factory.
19 /// </summary>
20 private IServiceProvider ServiceProvider { get; }
21
12 public bool TryCreateExtension(Type extensionType, out object extension) 22 public bool TryCreateExtension(Type extensionType, out object extension)
13 { 23 {
14 if (extensionType == typeof(IExtensionCommandLine) || extensionType == typeof(IPreprocessorExtension)) 24 if (extensionType == typeof(IExtensionCommandLine) || extensionType == typeof(IPreprocessorExtension))
15 { 25 {
16 if (preprocessorExtension == null) 26 if (this.preprocessorExtension == null)
17 { 27 {
18 preprocessorExtension = new ExamplePreprocessorExtensionAndCommandLine(); 28 this.preprocessorExtension = new ExamplePreprocessorExtensionAndCommandLine();
19 } 29 }
20 30
21 extension = preprocessorExtension; 31 extension = this.preprocessorExtension;
22 } 32 }
23 else if (extensionType == typeof(ICompilerExtension)) 33 else if (extensionType == typeof(ICompilerExtension))
24 { 34 {
@@ -28,7 +38,7 @@ namespace Example.Extension
28 { 38 {
29 extension = new ExampleExtensionData(); 39 extension = new ExampleExtensionData();
30 } 40 }
31 else if (extensionType == typeof(IWindowsInstallerBackendExtension)) 41 else if (extensionType == typeof(IWindowsInstallerBackendBinderExtension))
32 { 42 {
33 extension = new ExampleWindowsInstallerBackendExtension(); 43 extension = new ExampleWindowsInstallerBackendExtension();
34 } 44 }
@@ -36,7 +46,7 @@ namespace Example.Extension
36 { 46 {
37 extension = null; 47 extension = null;
38 } 48 }
39 49
40 return extension != null; 50 return extension != null;
41 } 51 }
42 } 52 }