Browse Source

Added first unit test for localization.

pull/138/head
Halil İbrahim Kalkan 9 years ago
parent
commit
aedc1d63c6
  1. 2
      docs/Getting-Started-AspNetCore-Application.md
  2. BIN
      src/AbpDesk/Web_PlugIns/AbpDesk.MongoBlog.dll
  3. 4
      src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs
  4. 3
      test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcTestModule.cs
  5. 2
      test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AspNetCoreMvcTestBase.cs
  6. 25
      test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Localization/MvcLocalization_Tests.cs

2
docs/Getting-Started-AspNetCore-Application.md

@ -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

BIN
src/AbpDesk/Web_PlugIns/AbpDesk.MongoBlog.dll

Binary file not shown.

4
src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs

@ -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)

3
test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcTestModule.cs

@ -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 =>
{

2
test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AspNetCoreMvcTestBase.cs

@ -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
{

25
test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Localization/MvcLocalization_Tests.cs

@ -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