diff --git a/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/App/LocalizationTestController.cs b/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/App/LocalizationTestController.cs
new file mode 100644
index 0000000000..5404746dc5
--- /dev/null
+++ b/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/App/LocalizationTestController.cs
@@ -0,0 +1,13 @@
+using Microsoft.AspNetCore.Mvc;
+using Volo.Abp.AspNetCore.Mvc;
+
+namespace Volo.Abp.AspNetCore.App
+{
+ public class LocalizationTestController : AbpController
+ {
+ public IActionResult Index1()
+ {
+ return View();
+ }
+ }
+}
diff --git a/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/App/Views/LocalizationTest/Index1.cshtml b/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/App/Views/LocalizationTest/Index1.cshtml
new file mode 100644
index 0000000000..ae2122e4f3
--- /dev/null
+++ b/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/App/Views/LocalizationTest/Index1.cshtml
@@ -0,0 +1,3 @@
+@using Microsoft.AspNetCore.Mvc.Localization
+@inject IViewLocalizer Localizer
+@Localizer["Hello {0}.", "John"]
\ No newline at end of file
diff --git a/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/App/Views/Simple/ExceptionOnRazor.cshtml b/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/App/Views/Simple/ExceptionOnRazor.cshtml
deleted file mode 100644
index 3a529fbf1f..0000000000
--- a/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/App/Views/Simple/ExceptionOnRazor.cshtml
+++ /dev/null
@@ -1,5 +0,0 @@
-@using Volo.Abp.Ui
-
Exception test
-@{
- throw new UserFriendlyException("test exception!");
-}
\ No newline at end of file
diff --git a/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcTestModule.cs b/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcTestModule.cs
index 4f8bc25beb..6e3bc29da5 100644
--- a/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcTestModule.cs
+++ b/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcTestModule.cs
@@ -21,7 +21,7 @@ namespace Volo.Abp.AspNetCore.Mvc
public override void ConfigureServices(IServiceCollection services)
{
services.AddLocalization(); //TODO: Move to AbpAspNetCoreMvcModule
- services.AddMvc(); //TODO: Move to AbpAspNetCoreMvcModule
+ services.AddMvc().AddViewLocalization(); //TODO: Move to AbpAspNetCoreMvcModule
services.Configure(options =>
{
diff --git a/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Localization/MvcLocalization_Tests.cs b/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Localization/MvcLocalization_Tests.cs
index 59d9bcbac4..8b16cfe8ed 100644
--- a/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Localization/MvcLocalization_Tests.cs
+++ b/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Localization/MvcLocalization_Tests.cs
@@ -1,4 +1,5 @@
-using Microsoft.Extensions.DependencyInjection;
+using System.Threading.Tasks;
+using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Localization;
using Shouldly;
using Xunit;
@@ -15,11 +16,18 @@ namespace Volo.Abp.AspNetCore.Mvc.Localization
}
[Fact]
- public void Should_Get_Same_Text_If_Not_Defined()
+ public void Should_Get_Same_Text_If_Not_Defined_From_StringLocalizer()
{
const string text = "A string that is not defined!";
_localizer[text].Value.ShouldBe(text);
}
+
+ [Fact]
+ public async Task Should_Get_Same_Text_If_Not_Defined_In_Razor_View()
+ {
+ var result = await GetResponseAsStringAsync("/LocalizationTest/Index1");
+ result.ShouldBe("Hello John.");
+ }
}
}