Attempt to fix bind tests for non-en-US
While it's definitly intended for `@bind` to have culture-sensitive output for most cases, we want the tests to behave consistently for all developers. So this is an attempt to use a fixed culture for all of our testing.
This commit is contained in:
parent
d96f444a6b
commit
3e10688d12
|
|
@ -1,6 +1,7 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System.Globalization;
|
||||||
using Microsoft.AspNetCore.Blazor.Hosting;
|
using Microsoft.AspNetCore.Blazor.Hosting;
|
||||||
|
|
||||||
namespace BasicTestApp
|
namespace BasicTestApp
|
||||||
|
|
@ -9,6 +10,9 @@ namespace BasicTestApp
|
||||||
{
|
{
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
|
// We want the culture to be en-US so that the tests for bind can work consistently.
|
||||||
|
CultureInfo.CurrentCulture = new CultureInfo("en-US");
|
||||||
|
|
||||||
CreateHostBuilder(args).Build().Run();
|
CreateHostBuilder(args).Build().Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Authentication.Cookies;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Localization;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
|
|
@ -76,7 +77,12 @@ namespace TestServer
|
||||||
options.AddSupportedCultures("en-US", "fr-FR");
|
options.AddSupportedCultures("en-US", "fr-FR");
|
||||||
options.AddSupportedUICultures("en-US", "fr-FR");
|
options.AddSupportedUICultures("en-US", "fr-FR");
|
||||||
|
|
||||||
// Cookie culture provider is included by default.
|
// Cookie culture provider is included by default, but we want it to be the only one.
|
||||||
|
options.RequestCultureProviders.Clear();
|
||||||
|
options.RequestCultureProviders.Add(new CookieRequestCultureProvider());
|
||||||
|
|
||||||
|
// We want the default to be en-US so that the tests for bind can work consistently.
|
||||||
|
options.SetDefaultCulture("en-US");
|
||||||
});
|
});
|
||||||
|
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue