AdaptiveCards
AdaptiveCards copied to clipboard
Adaptive Card Templating fails rendering cards using culture az-Latn-AZ
Adaptive Card Templating fails rendering cards using culture az-Latn-AZ
See unit tests below:
namespace Microsoft.Tests.Services.CardBuilders
{
using System.Collections.Generic;
using System.Globalization;
using AdaptiveCards.Templating;
using Microsoft.VisualStudio.TestTools.UnitTesting;
/// <summary>
/// Tests Adaptive Cards Templating.
/// </summary>
[TestClass]
public class AdaptiveCardsTemplating
{
/// <summary>
/// Test Rendering AC with Different Locales.
/// </summary>
[TestMethod]
public void TestRenderingAcWithDifferentLocales()
{
var cultures = new List<string>
{
"en-CA",
"en-US",
"fr-FR",
"pt-BR",
"az-Latn-AZ",
};
cultures.ForEach(TestAndAssert);
}
private static void TestAndAssert(string culture)
{
CultureInfo.CurrentCulture = new CultureInfo(culture, false);
const string templateJson = @"
{
""type"": ""AdaptiveCard"",
""version"": ""1.4"",
""body"": [
{
""id"": ""correlationId"",
""type"": ""TextBlock"",
""text"": ""${correlationIdText}""
}
]
}";
var template = new AdaptiveCardTemplate(templateJson);
var data = new
{
correlationIdText = "47e91b15-2a10-4dbb-9739-196f6fe615f3",
};
var cardJson = template.Expand(data);
const string expectedJson =
@"{""type"":""AdaptiveCard"",""version"":""1.4"",""body"":[{""id"":""correlationId"",""type"":""TextBlock"",""text"":""47e91b15-2a10-4dbb-9739-196f6fe615f3""}]}";
Assert.AreEqual(expectedJson, cardJson, $"Rendering not working for culture {culture}");
}
}
}
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: b499287b-06d7-456f-5d15-e50c954ace35
- Version Independent ID: be6accea-502b-6340-c71a-f92d43ce87f5
- Content: Templating SDKs - Adaptive Cards
- Content Source: AdaptiveCards/templating/sdk.md
- Product: adaptive-cards
- GitHub Login: @matthidinger
- Microsoft Alias: mahiding