build: 升级目标框架到net10.0并完善模板配置
1. 将Hua.Cli.Tests、项目共享库、模块项目等所有项目的TargetFramework从net8.0/net9.0升级到net10.0 2. 完善dotnet-tools.json、模板配置文件,添加必要的构建和发布配置 3. 新增微服务、网关、应用程序的启动脚本和基础配置文件 4. 补充产品管理模块的领域、应用、Web层基础代码和多语言资源
This commit is contained in:
+24
@@ -0,0 +1,24 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<RootNamespace />
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Volo.Abp.Autofac" Version="9.0.0" />
|
||||
<PackageReference Include="Volo.Abp.Authorization" Version="9.0.0" />
|
||||
<PackageReference Include="Volo.Abp.TestBase" Version="9.0.0" />
|
||||
<ProjectReference Include="..\..\src\ProductManagement.Domain\ProductManagement.Domain.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
|
||||
<PackageReference Include="NSubstitute" Version="4.2.2" />
|
||||
<PackageReference Include="Shouldly" Version="3.0.2" />
|
||||
<PackageReference Include="xunit" Version="2.6.0" />
|
||||
<PackageReference Include="xunit.extensibility.execution" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.2" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
using Volo.Abp;
|
||||
using Volo.Abp.Modularity;
|
||||
using Volo.Abp.Testing;
|
||||
|
||||
namespace ProductManagement
|
||||
{
|
||||
public abstract class ProductManagementTestBase<TStartupModule> : AbpIntegratedTest<TStartupModule>
|
||||
where TStartupModule : IAbpModule
|
||||
{
|
||||
protected override void SetAbpApplicationCreationOptions(AbpApplicationCreationOptions options)
|
||||
{
|
||||
options.UseAutofac();
|
||||
}
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Volo.Abp;
|
||||
using Volo.Abp.Authorization;
|
||||
using Volo.Abp.Autofac;
|
||||
using Volo.Abp.Modularity;
|
||||
using Volo.Abp.Uow;
|
||||
|
||||
namespace ProductManagement
|
||||
{
|
||||
[DependsOn(
|
||||
typeof(AbpAutofacModule),
|
||||
typeof(AbpTestBaseModule),
|
||||
typeof(AbpAuthorizationModule),
|
||||
typeof(ProductManagementDomainModule)
|
||||
)]
|
||||
public class ProductManagementTestBaseModule : AbpModule
|
||||
{
|
||||
public override void ConfigureServices(ServiceConfigurationContext context)
|
||||
{
|
||||
context.Services.AddAlwaysAllowAuthorization();
|
||||
|
||||
Configure<AbpUnitOfWorkDefaultOptions>(options =>
|
||||
{
|
||||
options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled;
|
||||
});
|
||||
}
|
||||
|
||||
public override void OnApplicationInitialization(ApplicationInitializationContext context)
|
||||
{
|
||||
SeedTestData(context);
|
||||
}
|
||||
|
||||
private static void SeedTestData(ApplicationInitializationContext context)
|
||||
{
|
||||
using (var scope = context.ServiceProvider.CreateScope())
|
||||
{
|
||||
scope.ServiceProvider
|
||||
.GetRequiredService<ProductManagementTestDataBuilder>()
|
||||
.Build();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
using Volo.Abp.DependencyInjection;
|
||||
|
||||
namespace ProductManagement
|
||||
{
|
||||
public class ProductManagementTestData : ISingletonDependency
|
||||
{
|
||||
public string ProductCode1 { get; } = "ProductCode1";
|
||||
|
||||
public string ProductName1 { get; } = "ProductName1";
|
||||
|
||||
public float ProductPrice1 { get; } = 20;
|
||||
|
||||
public int ProductStockCount1 { get; } = 100;
|
||||
|
||||
public string ProductCode2 { get; } = "ProductCode2";
|
||||
|
||||
public string ProductName2 { get; } = "ProductName2";
|
||||
|
||||
public float ProductPrice2 { get; } = 30;
|
||||
|
||||
public int ProductStockCount2 { get; } = 110;
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
using System.Threading.Tasks;
|
||||
using Volo.Abp.DependencyInjection;
|
||||
using Volo.Abp.Threading;
|
||||
using Volo.Abp.Uow;
|
||||
|
||||
namespace ProductManagement
|
||||
{
|
||||
public class ProductManagementTestDataBuilder : ITransientDependency
|
||||
{
|
||||
private ProductManagementTestData _testData;
|
||||
private readonly ProductManager _productManager;
|
||||
|
||||
public ProductManagementTestDataBuilder(
|
||||
ProductManagementTestData testData,
|
||||
ProductManager productManager)
|
||||
{
|
||||
_testData = testData;
|
||||
_productManager = productManager;
|
||||
}
|
||||
|
||||
public void Build()
|
||||
{
|
||||
AsyncHelper.RunSync(BuildAsync);
|
||||
}
|
||||
|
||||
[UnitOfWork]
|
||||
public virtual async Task BuildAsync()
|
||||
{
|
||||
await _productManager.CreateAsync(_testData.ProductCode1, _testData.ProductName1, _testData.ProductPrice1, _testData.ProductStockCount1);
|
||||
await _productManager.CreateAsync(_testData.ProductCode2, _testData.ProductName2, _testData.ProductPrice2, _testData.ProductStockCount2);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user