diff options
| author | Bob Arnson <bob@firegiant.com> | 2020-03-11 20:54:04 -0400 |
|---|---|---|
| committer | Bob Arnson <bob@firegiant.com> | 2020-03-11 22:13:02 -0400 |
| commit | 61d0e33943811cc31aeeae0c8c1c5c5768986bbe (patch) | |
| tree | 7dc8d2ea9bf729e593865e3b4ba88a1de61cc860 /src/test/WixToolsetTest.CoreIntegration/VariableResolverFixture.cs | |
| parent | 72b6f0109008103dfe974fa4d2d3ce42e7b6b53e (diff) | |
| download | wix-61d0e33943811cc31aeeae0c8c1c5c5768986bbe.tar.gz wix-61d0e33943811cc31aeeae0c8c1c5c5768986bbe.tar.bz2 wix-61d0e33943811cc31aeeae0c8c1c5c5768986bbe.zip | |
Fix https://github.com/wixtoolset/issues/issues/5860 recursive loc strings.
Diffstat (limited to 'src/test/WixToolsetTest.CoreIntegration/VariableResolverFixture.cs')
| -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 | } | ||
