rongguo.jia
2 years ago
25 changed files with 0 additions and 705 deletions
@ -1,33 +0,0 @@ |
|||
using Shouldly; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Identity; |
|||
using Xunit; |
|||
|
|||
namespace Win_in.Sfs.Scp.WebApi.Samples |
|||
{ |
|||
/* This is just an example test class. |
|||
* Normally, you don't test code of the modules you are using |
|||
* (like IIdentityUserAppService here). |
|||
* Only test your own application services. |
|||
*/ |
|||
public class SampleAppServiceTests : WebApiApplicationTestBase |
|||
{ |
|||
private readonly IIdentityUserAppService _userAppService; |
|||
|
|||
public SampleAppServiceTests() |
|||
{ |
|||
_userAppService = GetRequiredService<IIdentityUserAppService>(); |
|||
} |
|||
|
|||
[Fact] |
|||
public async Task Initial_Data_Should_Contain_Admin_User() |
|||
{ |
|||
//Act
|
|||
var result = await _userAppService.GetListAsync(new GetIdentityUsersInput()); |
|||
|
|||
//Assert
|
|||
result.TotalCount.ShouldBeGreaterThan(0); |
|||
result.Items.ShouldContain(u => u.UserName == "admin"); |
|||
} |
|||
} |
|||
} |
@ -1,7 +0,0 @@ |
|||
namespace Win_in.Sfs.Scp.WebApi |
|||
{ |
|||
public abstract class WebApiApplicationTestBase : WebApiTestBase<WebApiApplicationTestModule> |
|||
{ |
|||
|
|||
} |
|||
} |
@ -1,13 +0,0 @@ |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace Win_in.Sfs.Scp.WebApi |
|||
{ |
|||
[DependsOn( |
|||
typeof(WebApiApplicationModule), |
|||
typeof(WebApiDomainTestModule) |
|||
)] |
|||
public class WebApiApplicationTestModule : AbpModule |
|||
{ |
|||
|
|||
} |
|||
} |
@ -1,19 +0,0 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net5.0</TargetFramework> |
|||
<RootNamespace>Win_in.Sfs.Scp.WebApi</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\src\Win_in.Sfs.Scp.WebApi.Application\Win_in.Sfs.Scp.WebApi.Application.csproj" /> |
|||
<ProjectReference Include="..\Win_in.Sfs.Scp.WebApi.Domain.Tests\Win_in.Sfs.Scp.WebApi.Domain.Tests.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
@ -1,45 +0,0 @@ |
|||
using System.Threading.Tasks; |
|||
using Shouldly; |
|||
using Volo.Abp.Identity; |
|||
using Xunit; |
|||
|
|||
namespace Win_in.Sfs.Scp.WebApi.Samples |
|||
{ |
|||
/* This is just an example test class. |
|||
* Normally, you don't test code of the modules you are using |
|||
* (like IdentityUserManager here). |
|||
* Only test your own domain services. |
|||
*/ |
|||
public class SampleDomainTests : WebApiDomainTestBase |
|||
{ |
|||
private readonly IIdentityUserRepository _identityUserRepository; |
|||
private readonly IdentityUserManager _identityUserManager; |
|||
|
|||
public SampleDomainTests() |
|||
{ |
|||
_identityUserRepository = GetRequiredService<IIdentityUserRepository>(); |
|||
_identityUserManager = GetRequiredService<IdentityUserManager>(); |
|||
} |
|||
|
|||
[Fact] |
|||
public async Task Should_Set_Email_Of_A_User() |
|||
{ |
|||
IdentityUser adminUser; |
|||
|
|||
/* Need to manually start Unit Of Work because |
|||
* FirstOrDefaultAsync should be executed while db connection / context is available. |
|||
*/ |
|||
await WithUnitOfWorkAsync(async () => |
|||
{ |
|||
adminUser = await _identityUserRepository |
|||
.FindByNormalizedUserNameAsync("ADMIN"); |
|||
|
|||
await _identityUserManager.SetEmailAsync(adminUser, "newemail@abp.io"); |
|||
await _identityUserRepository.UpdateAsync(adminUser); |
|||
}); |
|||
|
|||
adminUser = await _identityUserRepository.FindByNormalizedUserNameAsync("ADMIN"); |
|||
adminUser.Email.ShouldBe("newemail@abp.io"); |
|||
} |
|||
} |
|||
} |
@ -1,7 +0,0 @@ |
|||
namespace Win_in.Sfs.Scp.WebApi |
|||
{ |
|||
public abstract class WebApiDomainTestBase : WebApiTestBase<WebApiDomainTestModule> |
|||
{ |
|||
|
|||
} |
|||
} |
@ -1,13 +0,0 @@ |
|||
using Win_in.Sfs.Scp.WebApi.EntityFrameworkCore; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace Win_in.Sfs.Scp.WebApi |
|||
{ |
|||
[DependsOn( |
|||
typeof(WebApiEntityFrameworkCoreTestModule) |
|||
)] |
|||
public class WebApiDomainTestModule : AbpModule |
|||
{ |
|||
|
|||
} |
|||
} |
@ -1,18 +0,0 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net5.0</TargetFramework> |
|||
<RootNamespace>Win_in.Sfs.Scp.WebApi</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\Win_in.Sfs.Scp.WebApi.EntityFrameworkCore.Tests\Win_in.Sfs.Scp.WebApi.EntityFrameworkCore.Tests.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
@ -1,44 +0,0 @@ |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Shouldly; |
|||
using System; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Domain.Repositories; |
|||
using Volo.Abp.Identity; |
|||
using Xunit; |
|||
|
|||
namespace Win_in.Sfs.Scp.WebApi.EntityFrameworkCore.Samples |
|||
{ |
|||
/* This is just an example test class. |
|||
* Normally, you don't test ABP framework code |
|||
* (like default AppUser repository IRepository<AppUser, Guid> here). |
|||
* Only test your custom repository methods. |
|||
*/ |
|||
public class SampleRepositoryTests : WebApiEntityFrameworkCoreTestBase |
|||
{ |
|||
private readonly IRepository<IdentityUser, Guid> _appUserRepository; |
|||
|
|||
public SampleRepositoryTests() |
|||
{ |
|||
_appUserRepository = GetRequiredService<IRepository<IdentityUser, Guid>>(); |
|||
} |
|||
|
|||
[Fact] |
|||
public async Task Should_Query_AppUser() |
|||
{ |
|||
/* Need to manually start Unit Of Work because |
|||
* FirstOrDefaultAsync should be executed while db connection / context is available. |
|||
*/ |
|||
await WithUnitOfWorkAsync(async () => |
|||
{ |
|||
//Act
|
|||
var adminUser = await (await _appUserRepository.GetQueryableAsync()) |
|||
.Where(u => u.UserName == "admin") |
|||
.FirstOrDefaultAsync(); |
|||
|
|||
//Assert
|
|||
adminUser.ShouldNotBeNull(); |
|||
}); |
|||
} |
|||
} |
|||
} |
@ -1,9 +0,0 @@ |
|||
using Volo.Abp; |
|||
|
|||
namespace Win_in.Sfs.Scp.WebApi.EntityFrameworkCore |
|||
{ |
|||
public abstract class WebApiEntityFrameworkCoreTestBase : WebApiTestBase<WebApiEntityFrameworkCoreTestModule> |
|||
{ |
|||
|
|||
} |
|||
} |
@ -1,62 +0,0 @@ |
|||
using Microsoft.Data.Sqlite; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Infrastructure; |
|||
using Microsoft.EntityFrameworkCore.Storage; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
using Volo.Abp.EntityFrameworkCore.Sqlite; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace Win_in.Sfs.Scp.WebApi.EntityFrameworkCore |
|||
{ |
|||
[DependsOn( |
|||
typeof(WebApiEntityFrameworkCoreModule), |
|||
typeof(WebApiTestBaseModule), |
|||
typeof(AbpEntityFrameworkCoreSqliteModule) |
|||
)] |
|||
public class WebApiEntityFrameworkCoreTestModule : AbpModule |
|||
{ |
|||
private SqliteConnection _sqliteConnection; |
|||
|
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
ConfigureInMemorySqlite(context.Services); |
|||
} |
|||
|
|||
private void ConfigureInMemorySqlite(IServiceCollection services) |
|||
{ |
|||
_sqliteConnection = CreateDatabaseAndGetConnection(); |
|||
|
|||
services.Configure<AbpDbContextOptions>(options => |
|||
{ |
|||
options.Configure(context => |
|||
{ |
|||
context.DbContextOptions.UseSqlite(_sqliteConnection); |
|||
}); |
|||
}); |
|||
} |
|||
|
|||
public override void OnApplicationShutdown(ApplicationShutdownContext context) |
|||
{ |
|||
_sqliteConnection.Dispose(); |
|||
} |
|||
|
|||
private static SqliteConnection CreateDatabaseAndGetConnection() |
|||
{ |
|||
var connection = new SqliteConnection("Data Source=:memory:"); |
|||
connection.Open(); |
|||
|
|||
var options = new DbContextOptionsBuilder<WebApiDbContext>() |
|||
.UseSqlite(connection) |
|||
.Options; |
|||
|
|||
using (var context = new WebApiDbContext(options)) |
|||
{ |
|||
context.GetService<IRelationalDatabaseCreator>().CreateTables(); |
|||
} |
|||
|
|||
return connection; |
|||
} |
|||
} |
|||
} |
@ -1,20 +0,0 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net5.0</TargetFramework> |
|||
<RootNamespace>Win_in.Sfs.Scp.WebApi</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\src\Win_in.Sfs.Scp.WebApi.EntityFrameworkCore\Win_in.Sfs.Scp.WebApi.EntityFrameworkCore.csproj" /> |
|||
<ProjectReference Include="..\Win_in.Sfs.Scp.WebApi.TestBase\Win_in.Sfs.Scp.WebApi.TestBase.csproj" /> |
|||
<PackageReference Include="Volo.Abp.EntityFrameworkCore.Sqlite" Version="4.4.2" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
@ -1,26 +0,0 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Identity; |
|||
|
|||
namespace Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp |
|||
{ |
|||
public class ClientDemoService : ITransientDependency |
|||
{ |
|||
private readonly IProfileAppService _profileAppService; |
|||
|
|||
public ClientDemoService(IProfileAppService profileAppService) |
|||
{ |
|||
_profileAppService = profileAppService; |
|||
} |
|||
|
|||
public async Task RunAsync() |
|||
{ |
|||
var output = await _profileAppService.GetAsync(); |
|||
Console.WriteLine($"UserName : {output.UserName}"); |
|||
Console.WriteLine($"Email : {output.Email}"); |
|||
Console.WriteLine($"Name : {output.Name}"); |
|||
Console.WriteLine($"Surname : {output.Surname}"); |
|||
} |
|||
} |
|||
} |
@ -1,37 +0,0 @@ |
|||
using Microsoft.Extensions.Hosting; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.Extensions.Configuration; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp; |
|||
|
|||
namespace Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp |
|||
{ |
|||
public class ConsoleTestAppHostedService : IHostedService |
|||
{ |
|||
private readonly IConfiguration _configuration; |
|||
|
|||
public ConsoleTestAppHostedService(IConfiguration configuration) |
|||
{ |
|||
_configuration = configuration; |
|||
} |
|||
|
|||
public async Task StartAsync(CancellationToken cancellationToken) |
|||
{ |
|||
using (var application = AbpApplicationFactory.Create<WebApiConsoleApiClientModule>(options => |
|||
{ |
|||
options.Services.ReplaceConfiguration(_configuration); |
|||
})) |
|||
{ |
|||
application.Initialize(); |
|||
|
|||
var demo = application.ServiceProvider.GetRequiredService<ClientDemoService>(); |
|||
await demo.RunAsync(); |
|||
|
|||
application.Shutdown(); |
|||
} |
|||
} |
|||
|
|||
public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; |
|||
} |
|||
} |
@ -1,26 +0,0 @@ |
|||
using System.Threading.Tasks; |
|||
using Microsoft.Extensions.Configuration; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Microsoft.Extensions.Hosting; |
|||
|
|||
namespace Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp |
|||
{ |
|||
class Program |
|||
{ |
|||
static async Task Main(string[] args) |
|||
{ |
|||
await CreateHostBuilder(args).RunConsoleAsync(); |
|||
} |
|||
|
|||
public static IHostBuilder CreateHostBuilder(string[] args) => |
|||
Host.CreateDefaultBuilder(args) |
|||
.ConfigureAppConfiguration(build => |
|||
{ |
|||
build.AddJsonFile("appsettings.secrets.json", optional: true); |
|||
}) |
|||
.ConfigureServices((hostContext, services) => |
|||
{ |
|||
services.AddHostedService<ConsoleTestAppHostedService>(); |
|||
}); |
|||
} |
|||
} |
@ -1,30 +0,0 @@ |
|||
using System; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Polly; |
|||
using Volo.Abp.Http.Client; |
|||
using Volo.Abp.Http.Client.IdentityModel; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp |
|||
{ |
|||
[DependsOn( |
|||
typeof(WebApiHttpApiClientModule), |
|||
typeof(AbpHttpClientIdentityModelModule), |
|||
typeof(WebApiApplicationContractsModule) |
|||
)] |
|||
public class WebApiConsoleApiClientModule : AbpModule |
|||
{ |
|||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
PreConfigure<AbpHttpClientBuilderOptions>(options => |
|||
{ |
|||
options.ProxyClientBuildActions.Add((remoteServiceName, clientBuilder) => |
|||
{ |
|||
clientBuilder.AddTransientHttpErrorPolicy( |
|||
policyBuilder => policyBuilder.WaitAndRetryAsync(3, i => TimeSpan.FromSeconds(Math.Pow(2, i))) |
|||
); |
|||
}); |
|||
}); |
|||
} |
|||
} |
|||
} |
@ -1,31 +0,0 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<PropertyGroup> |
|||
<OutputType>Exe</OutputType> |
|||
<TargetFramework>net5.0</TargetFramework> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<None Remove="appsettings.json" /> |
|||
<Content Include="appsettings.json"> |
|||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory> |
|||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
|||
</Content> |
|||
<None Remove="appsettings.secrets.json" /> |
|||
<Content Include="appsettings.secrets.json"> |
|||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory> |
|||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
|||
</Content> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.Http.Client.IdentityModel" Version="4.4.2" /> |
|||
<ProjectReference Include="..\..\src\Win_in.Sfs.Scp.WebApi.HttpApi.Client\Win_in.Sfs.Scp.WebApi.HttpApi.Client.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="5.0.*" /> |
|||
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="5.0.*" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
@ -1,18 +0,0 @@ |
|||
{ |
|||
"RemoteServices": { |
|||
"Default": { |
|||
"BaseUrl": "https://localhost:44359" |
|||
} |
|||
}, |
|||
"IdentityClients": { |
|||
"Default": { |
|||
"GrantType": "password", |
|||
"ClientId": "WebApi_App", |
|||
"ClientSecret": "1q2w3e*", |
|||
"UserName": "admin", |
|||
"UserPassword": "1q2w3E*", |
|||
"Authority": "https://localhost:44359", |
|||
"Scope": "WebApi" |
|||
} |
|||
} |
|||
} |
@ -1,2 +0,0 @@ |
|||
{ |
|||
} |
@ -1,43 +0,0 @@ |
|||
using System.Collections.Generic; |
|||
using System.Security.Claims; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Security.Claims; |
|||
|
|||
namespace Win_in.Sfs.Scp.WebApi.Security |
|||
{ |
|||
[Dependency(ReplaceServices = true)] |
|||
public class FakeCurrentPrincipalAccessor : ThreadCurrentPrincipalAccessor |
|||
{ |
|||
protected override ClaimsPrincipal GetClaimsPrincipal() |
|||
{ |
|||
return GetPrincipal(); |
|||
} |
|||
|
|||
private ClaimsPrincipal _principal; |
|||
|
|||
private ClaimsPrincipal GetPrincipal() |
|||
{ |
|||
if (_principal == null) |
|||
{ |
|||
lock (this) |
|||
{ |
|||
if (_principal == null) |
|||
{ |
|||
_principal = new ClaimsPrincipal( |
|||
new ClaimsIdentity( |
|||
new List<Claim> |
|||
{ |
|||
new Claim(AbpClaimTypes.UserId,"2e701e62-0953-4dd3-910b-dc6cc93ccb0d"), |
|||
new Claim(AbpClaimTypes.UserName,"admin"), |
|||
new Claim(AbpClaimTypes.Email,"admin@abp.io") |
|||
} |
|||
) |
|||
); |
|||
} |
|||
} |
|||
} |
|||
|
|||
return _principal; |
|||
} |
|||
} |
|||
} |
@ -1,61 +0,0 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.Uow; |
|||
using Volo.Abp.Testing; |
|||
|
|||
namespace Win_in.Sfs.Scp.WebApi |
|||
{ |
|||
/* All test classes are derived from this class, directly or indirectly. |
|||
*/ |
|||
public abstract class WebApiTestBase<TStartupModule> : AbpIntegratedTest<TStartupModule> |
|||
where TStartupModule : IAbpModule |
|||
{ |
|||
protected override void SetAbpApplicationCreationOptions(AbpApplicationCreationOptions options) |
|||
{ |
|||
options.UseAutofac(); |
|||
} |
|||
|
|||
protected virtual Task WithUnitOfWorkAsync(Func<Task> func) |
|||
{ |
|||
return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func); |
|||
} |
|||
|
|||
protected virtual async Task WithUnitOfWorkAsync(AbpUnitOfWorkOptions options, Func<Task> action) |
|||
{ |
|||
using (var scope = ServiceProvider.CreateScope()) |
|||
{ |
|||
var uowManager = scope.ServiceProvider.GetRequiredService<IUnitOfWorkManager>(); |
|||
|
|||
using (var uow = uowManager.Begin(options)) |
|||
{ |
|||
await action(); |
|||
|
|||
await uow.CompleteAsync(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
protected virtual Task<TResult> WithUnitOfWorkAsync<TResult>(Func<Task<TResult>> func) |
|||
{ |
|||
return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func); |
|||
} |
|||
|
|||
protected virtual async Task<TResult> WithUnitOfWorkAsync<TResult>(AbpUnitOfWorkOptions options, Func<Task<TResult>> func) |
|||
{ |
|||
using (var scope = ServiceProvider.CreateScope()) |
|||
{ |
|||
var uowManager = scope.ServiceProvider.GetRequiredService<IUnitOfWorkManager>(); |
|||
|
|||
using (var uow = uowManager.Begin(options)) |
|||
{ |
|||
var result = await func(); |
|||
await uow.CompleteAsync(); |
|||
return result; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
@ -1,62 +0,0 @@ |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Authorization; |
|||
using Volo.Abp.Autofac; |
|||
using Volo.Abp.BackgroundJobs; |
|||
using Volo.Abp.Data; |
|||
using Volo.Abp.IdentityServer; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.Threading; |
|||
|
|||
namespace Win_in.Sfs.Scp.WebApi |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpAutofacModule), |
|||
typeof(AbpTestBaseModule), |
|||
typeof(AbpAuthorizationModule), |
|||
typeof(WebApiDomainModule) |
|||
)] |
|||
public class WebApiTestBaseModule : AbpModule |
|||
{ |
|||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
PreConfigure<AbpIdentityServerBuilderOptions>(options => |
|||
{ |
|||
options.AddDeveloperSigningCredential = false; |
|||
}); |
|||
|
|||
PreConfigure<IIdentityServerBuilder>(identityServerBuilder => |
|||
{ |
|||
identityServerBuilder.AddDeveloperSigningCredential(false, System.Guid.NewGuid().ToString()); |
|||
}); |
|||
} |
|||
|
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
Configure<AbpBackgroundJobOptions>(options => |
|||
{ |
|||
options.IsJobExecutionEnabled = false; |
|||
}); |
|||
|
|||
context.Services.AddAlwaysAllowAuthorization(); |
|||
} |
|||
|
|||
public override void OnApplicationInitialization(ApplicationInitializationContext context) |
|||
{ |
|||
SeedTestData(context); |
|||
} |
|||
|
|||
private static void SeedTestData(ApplicationInitializationContext context) |
|||
{ |
|||
AsyncHelper.RunSync(async () => |
|||
{ |
|||
using (var scope = context.ServiceProvider.CreateScope()) |
|||
{ |
|||
await scope.ServiceProvider |
|||
.GetRequiredService<IDataSeeder>() |
|||
.SeedAsync(); |
|||
} |
|||
}); |
|||
} |
|||
} |
|||
} |
@ -1,16 +0,0 @@ |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Data; |
|||
using Volo.Abp.DependencyInjection; |
|||
|
|||
namespace Win_in.Sfs.Scp.WebApi |
|||
{ |
|||
public class WebApiTestDataSeedContributor : IDataSeedContributor, ITransientDependency |
|||
{ |
|||
public Task SeedAsync(DataSeedContext context) |
|||
{ |
|||
/* Seed additional test data... */ |
|||
|
|||
return Task.CompletedTask; |
|||
} |
|||
} |
|||
} |
@ -1,26 +0,0 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net5.0</TargetFramework> |
|||
<RootNamespace>Win_in.Sfs.Scp.WebApi</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.TestBase" Version="4.4.2" /> |
|||
<PackageReference Include="Volo.Abp.Autofac" Version="4.4.2" /> |
|||
<PackageReference Include="Volo.Abp.Authorization" Version="4.4.2" /> |
|||
<ProjectReference Include="..\..\src\Win_in.Sfs.Scp.WebApi.Domain\Win_in.Sfs.Scp.WebApi.Domain.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" /> |
|||
<PackageReference Include="NSubstitute" Version="4.2.2" /> |
|||
<PackageReference Include="Shouldly" Version="4.0.3" /> |
|||
<PackageReference Include="xunit" Version="2.4.1" /> |
|||
<PackageReference Include="xunit.extensibility.execution" Version="2.4.1" /> |
|||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
Loading…
Reference in new issue