diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Client.Tests/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClient_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Client.Tests/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClient_Tests.cs index 99c3e552d2..6784c69954 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Client.Tests/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClient_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Client.Tests/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClient_Tests.cs @@ -33,13 +33,14 @@ public class MvcCachedApplicationConfigurationClient_Tests : AbpAspNetCoreMvcCli } [Fact] - public async Task Should_Use_Concurrent_Requests_When_Culture_Matches() + public async Task Should_Use_CurrentUICulture_For_Localization_Request() { var cultureName = "en"; using (CultureHelper.Use(cultureName)) { - _configProxy.GetAsync(Arg.Any()).Returns(CreateConfigDto(cultureName)); + var configTcs = new TaskCompletionSource(); + _configProxy.GetAsync(Arg.Any()).Returns(configTcs.Task); var expectedResources = new Dictionary { @@ -48,12 +49,18 @@ public class MvcCachedApplicationConfigurationClient_Tests : AbpAspNetCoreMvcCli _localizationProxy.GetAsync(Arg.Any()).Returns(new ApplicationLocalizationDto { Resources = expectedResources }); - var result = await _applicationConfigurationClient.GetAsync(); + var resultTask = _applicationConfigurationClient.GetAsync(); + + // Localization request should be fired before config completes (concurrent). + await _localizationProxy.Received(1).GetAsync(Arg.Is(x => x.CultureName == cultureName && x.OnlyDynamics == true)); + + // Now let config complete. + configTcs.SetResult(CreateConfigDto(cultureName)); + var result = await resultTask; result.Localization.Resources.ShouldBe(expectedResources); await _configProxy.Received(1).GetAsync(Arg.Is(x => x.IncludeLocalizationResources == false)); - await _localizationProxy.Received(1).GetAsync(Arg.Is(x => x.CultureName == cultureName && x.OnlyDynamics == true)); } }