diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/WixToolsetTest.CoreIntegration/VariableResolverFixture.cs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/test/WixToolsetTest.CoreIntegration/VariableResolverFixture.cs b/src/test/WixToolsetTest.CoreIntegration/VariableResolverFixture.cs new file mode 100644 index 00000000..b53842f7 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/VariableResolverFixture.cs | |||
@@ -0,0 +1,37 @@ | |||
1 | |||
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 | namespace WixToolsetTest.CoreIntegration | ||
5 | { | ||
6 | using System.Collections.Generic; | ||
7 | using WixToolset.Core; | ||
8 | using WixToolset.Data; | ||
9 | using WixToolset.Data.Bind; | ||
10 | using WixToolset.Extensibility.Services; | ||
11 | using Xunit; | ||
12 | |||
13 | public class VariableResolverFixture | ||
14 | { | ||
15 | [Fact] | ||
16 | public void CanRecursivelyResolveVariables() | ||
17 | { | ||
18 | var serviceProvider = new WixToolsetServiceProvider(); | ||
19 | var variableResolver = serviceProvider.GetService<IVariableResolver>(); | ||
20 | |||
21 | var variables = new Dictionary<string, BindVariable>() | ||
22 | { | ||
23 | { "ProductName", new BindVariable() { Id = "ProductName", Value = "Localized Product Name" } }, | ||
24 | { "ProductNameEdition", new BindVariable() { Id = "ProductNameEdition", Value = "!(loc.ProductName) Enterprise Edition" } }, | ||
25 | { "ProductNameEditionVersion", new BindVariable() { Id = "ProductNameEditionVersion", Value = "!(loc.ProductNameEdition) v1.2.3" } }, | ||
26 | }; | ||
27 | |||
28 | var localization = new Localization(0, "x-none", variables, new Dictionary<string,LocalizedControl>()); | ||
29 | |||
30 | variableResolver.AddLocalization(localization); | ||
31 | |||
32 | Assert.Equal("Welcome to Localized Product Name", variableResolver.ResolveVariables(null, "Welcome to !(loc.ProductName)", false).Value); | ||
33 | Assert.Equal("Welcome to Localized Product Name Enterprise Edition", variableResolver.ResolveVariables(null, "Welcome to !(loc.ProductNameEdition)", false).Value); | ||
34 | Assert.Equal("Welcome to Localized Product Name Enterprise Edition v1.2.3", variableResolver.ResolveVariables(null, "Welcome to !(loc.ProductNameEditionVersion)", false).Value); | ||
35 | } | ||
36 | } | ||
37 | } | ||