Skip to content

Commit

Permalink
Merge pull request #19149 from Youssef1313/datetimeformatter
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund authored Jan 7, 2025
2 parents a6f6184 + ee46281 commit a3813a0
Show file tree
Hide file tree
Showing 7 changed files with 2,718 additions and 211 deletions.
19 changes: 7 additions & 12 deletions src/Uno.UI.Tests/Windows_Globalization/Given_CalendarFormatter.cs
Original file line number Diff line number Diff line change
@@ -1,32 +1,27 @@
using System.Globalization;
using System.Linq;
using Windows.Globalization.DateTimeFormatting;
using FluentAssertions;
using FluentAssertions.Execution;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Windows.Globalization.DateTimeFormatting;

namespace Uno.UI.Tests.Windows_Globalization
{
[TestClass]
public class Given_CalendarFormatter
{
[TestMethod]
[DataRow("day month year", "en-US", "{month.numeric}/{day.integer}/{year.full}")]
[DataRow("day month year", "en-CA", "{year.full}-{month.numeric}-{day.integer(2)}")]
[DataRow("day month year", "en-GB", "{day.integer(2)}/{month.numeric}/{year.full}")]
[DataRow("day month year", "fr-CA", "{year.full}-{month.numeric}-{day.integer(2)}")]
[DataRow("day month year", "fr-FR", "{day.integer(2)}/{month.numeric}/{year.full}")]
[DataRow("day month year", "hu-HU", "{year.full}. {month.numeric}. {day.integer(2)}.")]
[DataRow("day month year", "en-US", "{month.integer}/{day.integer}/{year.full}")]
[DataRow("day month year", "en-CA", "{year.full}-{month.integer(2)}-{day.integer(2)}")]
[DataRow("day month year", "en-GB", "{day.integer(2)}/{month.integer(2)}/{year.full}")]
[DataRow("day month year", "fr-CA", "{year.full}-{month.integer(2)}-{day.integer(2)}")]
[DataRow("day month year", "fr-FR", "{day.integer(2)}/{month.integer(2)}/{year.full}")]
[DataRow("day month year", "hu-HU", "{year.full}. {month.integer(2)}. {day.integer(2)}.")]
public void When_UsingVariousLanguages(string format, string language, string expectedPattern)
{
var sut = new DateTimeFormatter(format, new[] { language });

var firstPattern = sut.Patterns[0];

using var _ = new AssertionScope();

firstPattern.Should().Be(expectedPattern);
firstPattern.Length.Should().Be(expectedPattern.Length);
}

#if !NET7_0_OR_GREATER // https://github.com/unoplatform/uno/issues/9080
Expand Down
Loading

0 comments on commit a3813a0

Please sign in to comment.