Added first unit test for localization.

pull/138/head
Halil İbrahim Kalkan 7 years ago
parent af9cc3c7ee
commit aedc1d63c6

@ -125,7 +125,7 @@ namespace BasicAspNetCoreApplication.Controllers
If you run the application, you will see a "Hello World!" message on the page.
Devided ``HomeController`` from ``AbpController`` instead of standard ``Controller`` class. This is not required, but ``AbpController`` class has useful base properties and methods to make your development easier.
Derived ``HomeController`` from ``AbpController`` instead of standard ``Controller`` class. This is not required, but ``AbpController`` class has useful base properties and methods to make your development easier.
### Using Autofac as Dependency Injection Framework

@ -28,8 +28,6 @@ namespace Volo.Abp.AspNetCore.Mvc
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddAssemblyOf<AbpAspNetCoreMvcModule>();
//Configure Razor
services.Insert(0,
ServiceDescriptor.Singleton<IConfigureOptions<RazorViewEngineOptions>>(
@ -59,6 +57,8 @@ namespace Volo.Abp.AspNetCore.Mvc
o.RootPath = "abp";
});
});
services.AddAssemblyOf<AbpAspNetCoreMvcModule>();
}
public override void PostConfigureServices(IServiceCollection services)

@ -20,7 +20,8 @@ namespace Volo.Abp.AspNetCore.Mvc
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
services.AddLocalization(); //TODO: Move to AbpAspNetCoreMvcModule
services.AddMvc(); //TODO: Move to AbpAspNetCoreMvcModule
services.Configure<AbpAspNetCoreMvcOptions>(options =>
{

@ -1,8 +1,6 @@
using System;
using System.IO;
using System.Linq;
using Microsoft.AspNetCore.Hosting;
using Volo.Abp.AspNetCore.App;
namespace Volo.Abp.AspNetCore.Mvc
{

@ -0,0 +1,25 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Localization;
using Shouldly;
using Xunit;
namespace Volo.Abp.AspNetCore.Mvc.Localization
{
public class MvcLocalization_Tests : AspNetCoreMvcTestBase
{
private readonly IStringLocalizer _localizer;
public MvcLocalization_Tests()
{
_localizer = ServiceProvider.GetRequiredService<IStringLocalizer<MvcLocalization_Tests>>();
}
[Fact]
public void Should_Get_Same_Text_If_Not_Defined()
{
const string text = "A string that is not defined!";
_localizer[text].Value.ShouldBe(text);
}
}
}
Loading…
Cancel
Save