Want to test following code with different a culture other than the default:
public string Now =>
DateTime.Now.ToString("g", new CultureInfo(CultureInfo.CurrentUICulture.Name));
So far,
[UITestMethod]
public void UI_NowIsLocalizable()
{
// Arrange
Clock clock = new Clock();
Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = "de-DE";
string expected = DateTime.Now.ToString("g");
// Act
string actual = clock.Now;
// Assert
Assert.AreEqual(expected, actual);
}
While debugging the test, CultureInfo.CurrentUICulture.Name still shows us-en and the test passes (should fail).
Aucun commentaire:
Enregistrer un commentaire