mirror of https://github.com/abpframework/abp.git
21 changed files with 189 additions and 76 deletions
@ -0,0 +1,19 @@ |
|||
using System; |
|||
using AutoMapper; |
|||
|
|||
namespace Volo.Abp.AutoMapper |
|||
{ |
|||
public class AbpAutoMapperConfigurationContext : IAbpAutoMapperConfigurationContext |
|||
{ |
|||
public IMapperConfigurationExpression MapperConfiguration { get; } |
|||
public IServiceProvider ServiceProvider { get; } |
|||
|
|||
public AbpAutoMapperConfigurationContext( |
|||
IMapperConfigurationExpression mapperConfigurationExpression, |
|||
IServiceProvider serviceProvider) |
|||
{ |
|||
MapperConfiguration = mapperConfigurationExpression; |
|||
ServiceProvider = serviceProvider; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
using System; |
|||
using AutoMapper; |
|||
|
|||
namespace Volo.Abp.AutoMapper |
|||
{ |
|||
public interface IAbpAutoMapperConfigurationContext |
|||
{ |
|||
IMapperConfigurationExpression MapperConfiguration { get; } |
|||
|
|||
IServiceProvider ServiceProvider { get; } |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netcoreapp2.0</TargetFramework> |
|||
<AssemblyName>Volo.Abp.TestApp.Tests</AssemblyName> |
|||
<PackageId>Volo.Abp.TestApp.Tests</PackageId> |
|||
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles> |
|||
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> |
|||
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> |
|||
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> |
|||
<RootNamespace /> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\Volo.Abp.MemoryDb.Tests\Volo.Abp.MemoryDb.Tests.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,25 @@ |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Shouldly; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Xunit; |
|||
|
|||
namespace Volo.Abp.TestApp.Application |
|||
{ |
|||
public class PersonAppService_Tests : TestAppTestBase |
|||
{ |
|||
private readonly IPersonAppService _personAppService; |
|||
|
|||
public PersonAppService_Tests() |
|||
{ |
|||
_personAppService = ServiceProvider.GetRequiredService<IPersonAppService>(); |
|||
} |
|||
|
|||
[Fact] |
|||
public async Task GetAll() |
|||
{ |
|||
var people = await _personAppService.GetAll(new PagedAndSortedResultRequestDto()); |
|||
people.Items.Count.ShouldBeGreaterThan(0); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
using Volo.Abp.TestBase; |
|||
|
|||
namespace Volo.Abp.TestApp |
|||
{ |
|||
public class TestAppTestBase : AbpIntegratedTest<TestAppTestModule> |
|||
{ |
|||
protected override void SetAbpApplicationCreationOptions(AbpApplicationCreationOptions options) |
|||
{ |
|||
options.UseAutofac(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp.MemoryDb; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace Volo.Abp.TestApp |
|||
{ |
|||
[DependsOn(typeof(AbpMemoryDbTestModule))] |
|||
public class TestAppTestModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(IServiceCollection services) |
|||
{ |
|||
services.AddAssemblyOf<TestAppTestModule>(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
using Abp.Application.Services; |
|||
|
|||
namespace Volo.Abp.TestApp.Application |
|||
{ |
|||
public interface IPersonAppService : IAsyncCrudAppService<PersonDto> |
|||
{ |
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
using Abp.Application.Services; |
|||
using Volo.Abp.TestApp.Domain; |
|||
using Volo.Abp.Domain.Repositories; |
|||
|
|||
namespace Volo.Abp.TestApp.Application |
|||
{ |
|||
public class PersonAppService : AsyncCrudAppService<Person, PersonDto>, IPersonAppService |
|||
{ |
|||
public PersonAppService(IQueryableRepository<Person> repository) |
|||
: base(repository) |
|||
{ |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
using Volo.Abp.Application.Dtos; |
|||
|
|||
namespace Volo.Abp.TestApp.Application |
|||
{ |
|||
public class PersonDto : EntityDto |
|||
{ |
|||
public string Name { get; set; } |
|||
|
|||
public int Age { get; set; } |
|||
} |
|||
} |
|||
@ -1,17 +0,0 @@ |
|||
using System.Collections.Generic; |
|||
using Volo.Abp.Application.Services; |
|||
|
|||
namespace Volo.Abp.TestApp.Domain |
|||
{ |
|||
public class PersonAppService : ApplicationService |
|||
{ |
|||
public List<Person> GetAll() |
|||
{ |
|||
return new List<Person> |
|||
{ |
|||
new Person("John", 33), |
|||
new Person("Dougles", 42), |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue