diff --git a/src/BootstrapBlazor/Localization/Json/JsonLocalizationOptions.cs b/src/BootstrapBlazor/Localization/Json/JsonLocalizationOptions.cs index 8d6435eeffd..53f4271d99a 100644 --- a/src/BootstrapBlazor/Localization/Json/JsonLocalizationOptions.cs +++ b/src/BootstrapBlazor/Localization/Json/JsonLocalizationOptions.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the Apache 2.0 License // See the LICENSE file in the project root for more information. // Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone @@ -44,7 +44,7 @@ public class JsonLocalizationOptions : LocalizationOptions public bool IgnoreLocalizerMissing { get; set; } /// - /// 获得/设置 如果 Value 值为 null 时使用 Key 代替 默认 false 触发异常 + /// 获得/设置 如果 Value 值为 null 时使用 Key 代替 默认 false /// public bool UseKeyWhenValueIsNull { get; set; } diff --git a/test/UnitTest/Locales/en-US.json b/test/UnitTest/Locales/en-US.json index 9f650f7779b..2207cc94154 100644 --- a/test/UnitTest/Locales/en-US.json +++ b/test/UnitTest/Locales/en-US.json @@ -1,4 +1,4 @@ -{ +{ "BootstrapBlazor.Server.Data.Foo": { "Name": "Name", "DateTime": "DateTime", @@ -28,6 +28,6 @@ }, "UnitTest.Utils.UtilityTest": { "Test-Null": null, - "Test-Key:": "" + "Test-Key": "" } } diff --git a/test/UnitTest/Utils/UtilityTest.cs b/test/UnitTest/Utils/UtilityTest.cs index 994db7cc03b..12eb8f438ca 100644 --- a/test/UnitTest/Utils/UtilityTest.cs +++ b/test/UnitTest/Utils/UtilityTest.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the Apache 2.0 License // See the LICENSE file in the project root for more information. // Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone @@ -393,14 +393,19 @@ public void GetJsonStringByTypeName_UseKeyWhenValueIsNull() var test1 = items.FirstOrDefault(i => i.Name == "Test-Null"); Assert.NotNull(test1); + +#if NET9_0 + Assert.Equal("", test1.Value); +#elif NET10_0_OR_GREATER Assert.Equal("Test-Null", test1.Value); +#endif var test2 = items.FirstOrDefault(i => i.Name == "Test-Key"); Assert.NotNull(test2); - Assert.Equal("Test-Key", test2.Value); + Assert.Equal("", test2.Value); option.UseKeyWhenValueIsNull = false; - items = Utility.GetJsonStringByTypeName(option, this.GetType().Assembly, "UnitTest.Utils.UtilityTest", "en-US", true); + items = Utility.GetJsonStringByTypeName(option, GetType().Assembly, "UnitTest.Utils.UtilityTest", "en-US", true); test1 = items.FirstOrDefault(i => i.Name == "Test-Null"); Assert.NotNull(test1);