diff --git a/src/My.Extensions.Localization.Json/JsonStringLocalizer.cs b/src/My.Extensions.Localization.Json/JsonStringLocalizer.cs index d60aff8..2d45c7c 100644 --- a/src/My.Extensions.Localization.Json/JsonStringLocalizer.cs +++ b/src/My.Extensions.Localization.Json/JsonStringLocalizer.cs @@ -19,7 +19,7 @@ public class JsonStringLocalizer : IStringLocalizer private readonly IResourceStringProvider _resourceStringProvider; private readonly ILogger _logger; - private string _searchedLocation; + private string _searchedLocation = string.Empty; public JsonStringLocalizer( JsonResourceManager jsonResourceManager, diff --git a/test/My.Extensions.Localization.Json.Tests/JsonStringLocalizerFactoryTests.cs b/test/My.Extensions.Localization.Json.Tests/JsonStringLocalizerFactoryTests.cs index 1bf46c9..2687450 100644 --- a/test/My.Extensions.Localization.Json.Tests/JsonStringLocalizerFactoryTests.cs +++ b/test/My.Extensions.Localization.Json.Tests/JsonStringLocalizerFactoryTests.cs @@ -95,7 +95,7 @@ public async Task LocalizerReturnsTranslationFromInnerClass() { app.UseRequestLocalization("en", "ar"); - app.Run(context => + app.Run(async context => { var localizer = context.RequestServices.GetService>(); @@ -103,7 +103,7 @@ public async Task LocalizerReturnsTranslationFromInnerClass() Assert.Equal("مرحباً", localizer["Hello"]); - return Task.FromResult(0); + await Task.CompletedTask; }); }); diff --git a/test/My.Extensions.Localization.Json.Tests/JsonStringLocalizerTests.cs b/test/My.Extensions.Localization.Json.Tests/JsonStringLocalizerTests.cs index a2f7765..5b3cdae 100644 --- a/test/My.Extensions.Localization.Json.Tests/JsonStringLocalizerTests.cs +++ b/test/My.Extensions.Localization.Json.Tests/JsonStringLocalizerTests.cs @@ -149,7 +149,7 @@ public async void CultureBasedResourcesUsesIStringLocalizer() { app.UseRequestLocalization("en-US", "fr-FR"); - app.Run(context => + app.Run(async context => { var localizer = context.RequestServices.GetService>(); @@ -157,7 +157,7 @@ public async void CultureBasedResourcesUsesIStringLocalizer() Assert.Equal("Bonjour", localizer["Hello"]); - return Task.FromResult(0); + await Task.CompletedTask; }); });