diff --git a/Directory.Build.props b/Directory.Build.props index beb96eb4..81ec2e0d 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,8 +1,8 @@ - 7.2.1 - 2.5.0 + 7.3.0 + 2.7.0 \ No newline at end of file diff --git a/common.props b/common.props index da9e6566..544af831 100644 --- a/common.props +++ b/common.props @@ -1,7 +1,7 @@ latest - 2.7.0-preview.2 + 2.7.0 $(NoWarn);CS1591 true EasyAbp Team diff --git a/modules/EasyAbp.PaymentService.Prepayment/src/EasyAbp.PaymentService.Prepayment.Domain.Shared/EasyAbp.PaymentService.Prepayment.Domain.Shared.csproj b/modules/EasyAbp.PaymentService.Prepayment/src/EasyAbp.PaymentService.Prepayment.Domain.Shared/EasyAbp.PaymentService.Prepayment.Domain.Shared.csproj index ff136db5..66e85f9f 100644 --- a/modules/EasyAbp.PaymentService.Prepayment/src/EasyAbp.PaymentService.Prepayment.Domain.Shared/EasyAbp.PaymentService.Prepayment.Domain.Shared.csproj +++ b/modules/EasyAbp.PaymentService.Prepayment/src/EasyAbp.PaymentService.Prepayment.Domain.Shared/EasyAbp.PaymentService.Prepayment.Domain.Shared.csproj @@ -9,6 +9,7 @@ + diff --git a/modules/EasyAbp.PaymentService.Prepayment/src/EasyAbp.PaymentService.Prepayment.Domain.Shared/EasyAbp/PaymentService/Prepayment/PaymentServicePrepaymentDomainSharedModule.cs b/modules/EasyAbp.PaymentService.Prepayment/src/EasyAbp.PaymentService.Prepayment.Domain.Shared/EasyAbp/PaymentService/Prepayment/PaymentServicePrepaymentDomainSharedModule.cs index c98e0a91..0719373c 100644 --- a/modules/EasyAbp.PaymentService.Prepayment/src/EasyAbp.PaymentService.Prepayment.Domain.Shared/EasyAbp/PaymentService/Prepayment/PaymentServicePrepaymentDomainSharedModule.cs +++ b/modules/EasyAbp.PaymentService.Prepayment/src/EasyAbp.PaymentService.Prepayment.Domain.Shared/EasyAbp/PaymentService/Prepayment/PaymentServicePrepaymentDomainSharedModule.cs @@ -1,4 +1,5 @@ -using Volo.Abp.Modularity; +using Volo.Abp.Domain; +using Volo.Abp.Modularity; using Volo.Abp.Localization; using EasyAbp.PaymentService.Prepayment.Localization; using Volo.Abp.Localization.ExceptionHandling; @@ -9,7 +10,8 @@ namespace EasyAbp.PaymentService.Prepayment { [DependsOn( - typeof(AbpValidationModule) + typeof(AbpValidationModule), + typeof(AbpDddDomainSharedModule) )] public class PaymentServicePrepaymentDomainSharedModule : AbpModule { diff --git a/modules/EasyAbp.PaymentService.Prepayment/src/EasyAbp.PaymentService.Prepayment.EntityFrameworkCore/EasyAbp/PaymentService/Prepayment/EntityFrameworkCore/PaymentServicePrepaymentEntityFrameworkCoreModule.cs b/modules/EasyAbp.PaymentService.Prepayment/src/EasyAbp.PaymentService.Prepayment.EntityFrameworkCore/EasyAbp/PaymentService/Prepayment/EntityFrameworkCore/PaymentServicePrepaymentEntityFrameworkCoreModule.cs index 8758013d..1e70783b 100644 --- a/modules/EasyAbp.PaymentService.Prepayment/src/EasyAbp.PaymentService.Prepayment.EntityFrameworkCore/EasyAbp/PaymentService/Prepayment/EntityFrameworkCore/PaymentServicePrepaymentEntityFrameworkCoreModule.cs +++ b/modules/EasyAbp.PaymentService.Prepayment/src/EasyAbp.PaymentService.Prepayment.EntityFrameworkCore/EasyAbp/PaymentService/Prepayment/EntityFrameworkCore/PaymentServicePrepaymentEntityFrameworkCoreModule.cs @@ -5,6 +5,7 @@ using Microsoft.Extensions.DependencyInjection; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.Modularity; +using WithdrawalRequests; namespace EasyAbp.PaymentService.Prepayment.EntityFrameworkCore { diff --git a/modules/EasyAbp.PaymentService.Prepayment/src/EasyAbp.PaymentService.Prepayment.EntityFrameworkCore/WithdrawalRequests/WithdrawalRequestEfCoreQuerableExtensions.cs b/modules/EasyAbp.PaymentService.Prepayment/src/EasyAbp.PaymentService.Prepayment.EntityFrameworkCore/WithdrawalRequests/WithdrawalRequestEfCoreQuerableExtensions.cs index 020b4f5b..8c78b059 100644 --- a/modules/EasyAbp.PaymentService.Prepayment/src/EasyAbp.PaymentService.Prepayment.EntityFrameworkCore/WithdrawalRequests/WithdrawalRequestEfCoreQuerableExtensions.cs +++ b/modules/EasyAbp.PaymentService.Prepayment/src/EasyAbp.PaymentService.Prepayment.EntityFrameworkCore/WithdrawalRequests/WithdrawalRequestEfCoreQuerableExtensions.cs @@ -1,7 +1,7 @@ using System.Linq; -using Microsoft.EntityFrameworkCore; +using EasyAbp.PaymentService.Prepayment.WithdrawalRequests; -namespace EasyAbp.PaymentService.Prepayment.WithdrawalRequests +namespace WithdrawalRequests { public static class WithdrawalRequestEfCoreQueryableExtensions { diff --git a/modules/EasyAbp.PaymentService.Prepayment/src/EasyAbp.PaymentService.Prepayment.EntityFrameworkCore/WithdrawalRequests/WithdrawalRequestRepository.cs b/modules/EasyAbp.PaymentService.Prepayment/src/EasyAbp.PaymentService.Prepayment.EntityFrameworkCore/WithdrawalRequests/WithdrawalRequestRepository.cs index c9b332b3..dd65106d 100644 --- a/modules/EasyAbp.PaymentService.Prepayment/src/EasyAbp.PaymentService.Prepayment.EntityFrameworkCore/WithdrawalRequests/WithdrawalRequestRepository.cs +++ b/modules/EasyAbp.PaymentService.Prepayment/src/EasyAbp.PaymentService.Prepayment.EntityFrameworkCore/WithdrawalRequests/WithdrawalRequestRepository.cs @@ -1,9 +1,10 @@ using System; using EasyAbp.PaymentService.Prepayment.EntityFrameworkCore; +using EasyAbp.PaymentService.Prepayment.WithdrawalRequests; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; -namespace EasyAbp.PaymentService.Prepayment.WithdrawalRequests +namespace WithdrawalRequests { public class WithdrawalRequestRepository : EfCoreRepository, IWithdrawalRequestRepository { diff --git a/modules/EasyAbp.PaymentService.Prepayment/src/EasyAbp.PaymentService.Prepayment.Web/Pages/PaymentService/Prepayment/Index.cshtml b/modules/EasyAbp.PaymentService.Prepayment/src/EasyAbp.PaymentService.Prepayment.Web/Pages/PaymentService/Prepayment/Index.cshtml index 0f5c72e5..17a64b77 100644 --- a/modules/EasyAbp.PaymentService.Prepayment/src/EasyAbp.PaymentService.Prepayment.Web/Pages/PaymentService/Prepayment/Index.cshtml +++ b/modules/EasyAbp.PaymentService.Prepayment/src/EasyAbp.PaymentService.Prepayment.Web/Pages/PaymentService/Prepayment/Index.cshtml @@ -1,7 +1,7 @@ @page @using Microsoft.Extensions.Localization @using EasyAbp.PaymentService.Prepayment.Localization -@model EasyAbp.PaymentService.Prepayment.Web.Pages.Prepayment.IndexModel +@model EasyAbp.PaymentService.Prepayment.Web.Pages.PaymentService.Prepayment.IndexModel @inject IStringLocalizer L @{ } diff --git a/modules/EasyAbp.PaymentService.Prepayment/src/EasyAbp.PaymentService.Prepayment.Web/Pages/PaymentService/Prepayment/Index.cshtml.cs b/modules/EasyAbp.PaymentService.Prepayment/src/EasyAbp.PaymentService.Prepayment.Web/Pages/PaymentService/Prepayment/Index.cshtml.cs index 42a55d8d..856c4af6 100644 --- a/modules/EasyAbp.PaymentService.Prepayment/src/EasyAbp.PaymentService.Prepayment.Web/Pages/PaymentService/Prepayment/Index.cshtml.cs +++ b/modules/EasyAbp.PaymentService.Prepayment/src/EasyAbp.PaymentService.Prepayment.Web/Pages/PaymentService/Prepayment/Index.cshtml.cs @@ -1,4 +1,4 @@ -namespace EasyAbp.PaymentService.Prepayment.Web.Pages.Prepayment +namespace EasyAbp.PaymentService.Prepayment.Web.Pages.PaymentService.Prepayment { public class IndexModel : PrepaymentPageModel { diff --git a/modules/EasyAbp.PaymentService.Prepayment/test/EasyAbp.PaymentService.Prepayment.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs b/modules/EasyAbp.PaymentService.Prepayment/test/EasyAbp.PaymentService.Prepayment.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs index 176e979d..4cb2ede7 100644 --- a/modules/EasyAbp.PaymentService.Prepayment/test/EasyAbp.PaymentService.Prepayment.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs +++ b/modules/EasyAbp.PaymentService.Prepayment/test/EasyAbp.PaymentService.Prepayment.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs @@ -1,10 +1,10 @@ -using Microsoft.Extensions.Hosting; -using System.Threading; +using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; using Volo.Abp; -namespace EasyAbp.PaymentService.Prepayment.HttpApi.Client.ConsoleTestApp +namespace EasyAbp.PaymentService.Prepayment { public class ConsoleTestAppHostedService : IHostedService { diff --git a/modules/EasyAbp.PaymentService.Prepayment/test/EasyAbp.PaymentService.Prepayment.HttpApi.Client.ConsoleTestApp/Program.cs b/modules/EasyAbp.PaymentService.Prepayment/test/EasyAbp.PaymentService.Prepayment.HttpApi.Client.ConsoleTestApp/Program.cs index d4e38e71..7f485fdf 100644 --- a/modules/EasyAbp.PaymentService.Prepayment/test/EasyAbp.PaymentService.Prepayment.HttpApi.Client.ConsoleTestApp/Program.cs +++ b/modules/EasyAbp.PaymentService.Prepayment/test/EasyAbp.PaymentService.Prepayment.HttpApi.Client.ConsoleTestApp/Program.cs @@ -2,7 +2,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; -namespace EasyAbp.PaymentService.Prepayment.HttpApi.Client.ConsoleTestApp +namespace EasyAbp.PaymentService.Prepayment { class Program { diff --git a/modules/EasyAbp.PaymentService.Prepayment/test/EasyAbp.PaymentService.Prepayment.MongoDB.Tests/EasyAbp.PaymentService.Prepayment.MongoDB.Tests.csproj b/modules/EasyAbp.PaymentService.Prepayment/test/EasyAbp.PaymentService.Prepayment.MongoDB.Tests/EasyAbp.PaymentService.Prepayment.MongoDB.Tests.csproj index 431d9e91..1cb46b1b 100644 --- a/modules/EasyAbp.PaymentService.Prepayment/test/EasyAbp.PaymentService.Prepayment.MongoDB.Tests/EasyAbp.PaymentService.Prepayment.MongoDB.Tests.csproj +++ b/modules/EasyAbp.PaymentService.Prepayment/test/EasyAbp.PaymentService.Prepayment.MongoDB.Tests/EasyAbp.PaymentService.Prepayment.MongoDB.Tests.csproj @@ -7,7 +7,10 @@ - + + + + diff --git a/modules/EasyAbp.PaymentService.Prepayment/test/EasyAbp.PaymentService.Prepayment.MongoDB.Tests/MongoDB/MongoDbFixture.cs b/modules/EasyAbp.PaymentService.Prepayment/test/EasyAbp.PaymentService.Prepayment.MongoDB.Tests/MongoDB/MongoDbFixture.cs index ece7ee5a..b512e798 100644 --- a/modules/EasyAbp.PaymentService.Prepayment/test/EasyAbp.PaymentService.Prepayment.MongoDB.Tests/MongoDB/MongoDbFixture.cs +++ b/modules/EasyAbp.PaymentService.Prepayment/test/EasyAbp.PaymentService.Prepayment.MongoDB.Tests/MongoDB/MongoDbFixture.cs @@ -1,17 +1,30 @@ using System; -using Mongo2Go; +using EphemeralMongo; namespace EasyAbp.PaymentService.Prepayment.MongoDB { public class MongoDbFixture : IDisposable { - private static readonly MongoDbRunner MongoDbRunner; - public static readonly string ConnectionString; + public readonly static IMongoRunner MongoDbRunner; static MongoDbFixture() { - MongoDbRunner = MongoDbRunner.Start(); - ConnectionString = MongoDbRunner.ConnectionString; + MongoDbRunner = MongoRunner.Run(new MongoRunnerOptions + { + UseSingleNodeReplicaSet = true + }); + } + + public static string GetRandomConnectionString() + { + return GetConnectionString("Db_" + Guid.NewGuid().ToString("N")); + } + + public static string GetConnectionString(string databaseName) + { + var stringArray = MongoDbRunner.ConnectionString.Split('?'); + var connectionString = stringArray[0].EnsureEndsWith('/') + databaseName + "/?" + stringArray[1]; + return connectionString; } public void Dispose() diff --git a/modules/EasyAbp.PaymentService.Prepayment/test/EasyAbp.PaymentService.Prepayment.MongoDB.Tests/MongoDB/PrepaymentMongoDbTestModule.cs b/modules/EasyAbp.PaymentService.Prepayment/test/EasyAbp.PaymentService.Prepayment.MongoDB.Tests/MongoDB/PrepaymentMongoDbTestModule.cs index 4f7737fa..91b2ca79 100644 --- a/modules/EasyAbp.PaymentService.Prepayment/test/EasyAbp.PaymentService.Prepayment.MongoDB.Tests/MongoDB/PrepaymentMongoDbTestModule.cs +++ b/modules/EasyAbp.PaymentService.Prepayment/test/EasyAbp.PaymentService.Prepayment.MongoDB.Tests/MongoDB/PrepaymentMongoDbTestModule.cs @@ -12,13 +12,9 @@ public class PrepaymentMongoDbTestModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { - var connectionString = MongoDbFixture.ConnectionString.EnsureEndsWith('/') + - "Db_" + - Guid.NewGuid().ToString("N"); - Configure(options => { - options.ConnectionStrings.Default = connectionString; + options.ConnectionStrings.Default = MongoDbFixture.GetRandomConnectionString(); }); } } diff --git a/modules/EasyAbp.PaymentService.WeChatPay/src/EasyAbp.PaymentService.WeChatPay.Domain.Shared/EasyAbp.PaymentService.WeChatPay.Domain.Shared.csproj b/modules/EasyAbp.PaymentService.WeChatPay/src/EasyAbp.PaymentService.WeChatPay.Domain.Shared/EasyAbp.PaymentService.WeChatPay.Domain.Shared.csproj index 21efa113..05759dbb 100644 --- a/modules/EasyAbp.PaymentService.WeChatPay/src/EasyAbp.PaymentService.WeChatPay.Domain.Shared/EasyAbp.PaymentService.WeChatPay.Domain.Shared.csproj +++ b/modules/EasyAbp.PaymentService.WeChatPay/src/EasyAbp.PaymentService.WeChatPay.Domain.Shared/EasyAbp.PaymentService.WeChatPay.Domain.Shared.csproj @@ -9,6 +9,7 @@ + diff --git a/modules/EasyAbp.PaymentService.WeChatPay/src/EasyAbp.PaymentService.WeChatPay.Domain.Shared/EasyAbp/PaymentService/WeChatPay/PaymentServiceWeChatPayDomainSharedModule.cs b/modules/EasyAbp.PaymentService.WeChatPay/src/EasyAbp.PaymentService.WeChatPay.Domain.Shared/EasyAbp/PaymentService/WeChatPay/PaymentServiceWeChatPayDomainSharedModule.cs index a4cf67da..0884cbd0 100644 --- a/modules/EasyAbp.PaymentService.WeChatPay/src/EasyAbp.PaymentService.WeChatPay.Domain.Shared/EasyAbp/PaymentService/WeChatPay/PaymentServiceWeChatPayDomainSharedModule.cs +++ b/modules/EasyAbp.PaymentService.WeChatPay/src/EasyAbp.PaymentService.WeChatPay.Domain.Shared/EasyAbp/PaymentService/WeChatPay/PaymentServiceWeChatPayDomainSharedModule.cs @@ -1,4 +1,5 @@ -using Volo.Abp.Modularity; +using Volo.Abp.Domain; +using Volo.Abp.Modularity; using Volo.Abp.Localization; using EasyAbp.PaymentService.WeChatPay.Localization; using Volo.Abp.Localization.ExceptionHandling; @@ -9,7 +10,8 @@ namespace EasyAbp.PaymentService.WeChatPay { [DependsOn( - typeof(AbpValidationModule) + typeof(AbpValidationModule), + typeof(AbpDddDomainSharedModule) )] public class PaymentServiceWeChatPayDomainSharedModule : AbpModule { diff --git a/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.Application.Tests/PaymentServiceWeChatPayApplicationTestModule.cs b/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.Application.Tests/PaymentServiceWeChatPayApplicationTestModule.cs index 8993808b..ea19158b 100644 --- a/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.Application.Tests/PaymentServiceWeChatPayApplicationTestModule.cs +++ b/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.Application.Tests/PaymentServiceWeChatPayApplicationTestModule.cs @@ -1,6 +1,6 @@ -using EasyAbp.PaymentService; -using EasyAbp.PaymentService.WeChatPay; -using Volo.Abp.Modularity; +using Volo.Abp.Modularity; + +namespace EasyAbp.PaymentService.WeChatPay; [DependsOn( typeof(PaymentServiceApplicationModule), diff --git a/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.Application.Tests/WeChatPayApplicationTestBase.cs b/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.Application.Tests/WeChatPayApplicationTestBase.cs index 81cd0115..3707edaf 100644 --- a/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.Application.Tests/WeChatPayApplicationTestBase.cs +++ b/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.Application.Tests/WeChatPayApplicationTestBase.cs @@ -2,6 +2,8 @@ /* Inherit from this class for your application layer tests. * See SampleAppService_Tests for example. */ +namespace EasyAbp.PaymentService.WeChatPay; + public abstract class WeChatPayApplicationTestBase : WeChatPayTestBase { diff --git a/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.Domain.Tests/PaymentServiceWeChatPayDomainTestModule.cs b/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.Domain.Tests/PaymentServiceWeChatPayDomainTestModule.cs index f4b6ec01..04386809 100644 --- a/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.Domain.Tests/PaymentServiceWeChatPayDomainTestModule.cs +++ b/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.Domain.Tests/PaymentServiceWeChatPayDomainTestModule.cs @@ -6,6 +6,8 @@ * You can switch to MongoDB, however your domain tests should be * database independent anyway. */ +namespace EasyAbp.PaymentService.WeChatPay; + [DependsOn( typeof(PaymentServiceEntityFrameworkCoreTestModule), typeof(PaymentServiceWeChatPayEntityFrameworkCoreTestModule) diff --git a/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.Domain.Tests/WeChatPayDomainTestBase.cs b/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.Domain.Tests/WeChatPayDomainTestBase.cs index 80d577b3..ec7e7063 100644 --- a/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.Domain.Tests/WeChatPayDomainTestBase.cs +++ b/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.Domain.Tests/WeChatPayDomainTestBase.cs @@ -2,6 +2,8 @@ /* Inherit from this class for your domain layer tests. * See SampleManager_Tests for example. */ +namespace EasyAbp.PaymentService.WeChatPay; + public abstract class WeChatPayDomainTestBase : WeChatPayTestBase { diff --git a/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs b/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs index 54b24036..aeea2896 100644 --- a/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs +++ b/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs @@ -6,6 +6,8 @@ using Volo.Abp.DependencyInjection; using Volo.Abp.IdentityModel; +namespace EasyAbp.PaymentService.WeChatPay; + public class ClientDemoService : ITransientDependency { private readonly IIdentityModelAuthenticationService _authenticationService; @@ -27,9 +29,9 @@ public async Task RunAsync() } /* Shows how to perform an HTTP request to the API using ABP's dynamic c# proxy - * feature. It is just simple as calling a local service method. - * Authorization and HTTP request details are handled by the ABP framework. - */ + * feature. It is just simple as calling a local service method. + * Authorization and HTTP request details are handled by the ABP framework. + */ private async Task TestWithDynamicProxiesAsync() { Console.WriteLine(); @@ -37,8 +39,8 @@ private async Task TestWithDynamicProxiesAsync() } /* Shows how to use HttpClient to perform a request to the HTTP API. - * It uses ABP's IIdentityModelAuthenticationService to simplify obtaining access tokens. - */ + * It uses ABP's IIdentityModelAuthenticationService to simplify obtaining access tokens. + */ private async Task TestWithHttpClientAndIdentityModelAuthenticationServiceAsync() { Console.WriteLine(); @@ -81,9 +83,9 @@ private async Task TestWithHttpClientAndIdentityModelAuthenticationServiceAsync( } /* Shows how to use HttpClient to perform a request to the HTTP API. - * It obtains access token using IdentityServer's API. See its documentation: - * https://identityserver4.readthedocs.io/en/latest/quickstarts/2_resource_owner_passwords.html - */ + * It obtains access token using IdentityServer's API. See its documentation: + * https://identityserver4.readthedocs.io/en/latest/quickstarts/2_resource_owner_passwords.html + */ private async Task TestAllManuallyAsync() { Console.WriteLine(); diff --git a/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs b/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs index c29155e0..df363a39 100644 --- a/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs +++ b/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs @@ -4,6 +4,8 @@ using Microsoft.Extensions.Hosting; using Volo.Abp; +namespace EasyAbp.PaymentService.WeChatPay; + public class ConsoleTestAppHostedService : IHostedService { public async Task StartAsync(CancellationToken cancellationToken) diff --git a/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.HttpApi.Client.ConsoleTestApp/PaymentServiceWeChatPayConsoleApiClientModule.cs b/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.HttpApi.Client.ConsoleTestApp/PaymentServiceWeChatPayConsoleApiClientModule.cs index 201f4438..ec1bb1dd 100644 --- a/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.HttpApi.Client.ConsoleTestApp/PaymentServiceWeChatPayConsoleApiClientModule.cs +++ b/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.HttpApi.Client.ConsoleTestApp/PaymentServiceWeChatPayConsoleApiClientModule.cs @@ -1,7 +1,8 @@ -using EasyAbp.PaymentService.WeChatPay; -using Volo.Abp.Http.Client.IdentityModel; +using Volo.Abp.Http.Client.IdentityModel; using Volo.Abp.Modularity; +namespace EasyAbp.PaymentService.WeChatPay; + [DependsOn( typeof(PaymentServiceWeChatPayHttpApiClientModule), typeof(AbpHttpClientIdentityModelModule) diff --git a/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.HttpApi.Client.ConsoleTestApp/Program.cs b/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.HttpApi.Client.ConsoleTestApp/Program.cs index 938e7373..7b49c55a 100644 --- a/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.HttpApi.Client.ConsoleTestApp/Program.cs +++ b/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.HttpApi.Client.ConsoleTestApp/Program.cs @@ -2,6 +2,8 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; +namespace EasyAbp.PaymentService.WeChatPay; + class Program { static async Task Main(string[] args) diff --git a/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.MongoDB.Tests/EasyAbp.PaymentService.WeChatPay.MongoDB.Tests.csproj b/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.MongoDB.Tests/EasyAbp.PaymentService.WeChatPay.MongoDB.Tests.csproj index 4be04b1d..7b921166 100644 --- a/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.MongoDB.Tests/EasyAbp.PaymentService.WeChatPay.MongoDB.Tests.csproj +++ b/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.MongoDB.Tests/EasyAbp.PaymentService.WeChatPay.MongoDB.Tests.csproj @@ -7,7 +7,10 @@ - + + + + diff --git a/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.MongoDB.Tests/MongoDB/MongoDbFixture.cs b/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.MongoDB.Tests/MongoDB/MongoDbFixture.cs new file mode 100644 index 00000000..966c779a --- /dev/null +++ b/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.MongoDB.Tests/MongoDB/MongoDbFixture.cs @@ -0,0 +1,35 @@ +using System; +using EphemeralMongo; + +namespace EasyAbp.PaymentService.WeChatPay.MongoDB +{ + public class MongoDbFixture : IDisposable + { + public readonly static IMongoRunner MongoDbRunner; + + static MongoDbFixture() + { + MongoDbRunner = MongoRunner.Run(new MongoRunnerOptions + { + UseSingleNodeReplicaSet = true + }); + } + + public static string GetRandomConnectionString() + { + return GetConnectionString("Db_" + Guid.NewGuid().ToString("N")); + } + + public static string GetConnectionString(string databaseName) + { + var stringArray = MongoDbRunner.ConnectionString.Split('?'); + var connectionString = stringArray[0].EnsureEndsWith('/') + databaseName + "/?" + stringArray[1]; + return connectionString; + } + + public void Dispose() + { + MongoDbRunner?.Dispose(); + } + } +} diff --git a/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.MongoDB.Tests/MongoDB/MongoTestCollection.cs b/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.MongoDB.Tests/MongoDB/MongoTestCollection.cs new file mode 100644 index 00000000..96fdb87f --- /dev/null +++ b/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.MongoDB.Tests/MongoDB/MongoTestCollection.cs @@ -0,0 +1,10 @@ +using Xunit; + +namespace EasyAbp.PaymentService.WeChatPay.MongoDB +{ + [CollectionDefinition(Name)] + public class MongoTestCollection : ICollectionFixture + { + public const string Name = "MongoDB Collection"; + } +} \ No newline at end of file diff --git a/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.MongoDB.Tests/MongoDB/PaymentServiceWeChatPayMongoDbTestModule.cs b/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.MongoDB.Tests/MongoDB/PaymentServiceWeChatPayMongoDbTestModule.cs index 08ef9fe2..df4e0e70 100644 --- a/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.MongoDB.Tests/MongoDB/PaymentServiceWeChatPayMongoDbTestModule.cs +++ b/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.MongoDB.Tests/MongoDB/PaymentServiceWeChatPayMongoDbTestModule.cs @@ -1,10 +1,7 @@ -using System; -using EasyAbp.PaymentService.WeChatPay.MongoDB; -using Mongo2Go; -using Volo.Abp.Data; +using Volo.Abp.Data; using Volo.Abp.Modularity; -namespace MongoDB +namespace EasyAbp.PaymentService.WeChatPay.MongoDB { [DependsOn( typeof(PaymentServiceWeChatPayTestBaseModule), @@ -12,17 +9,11 @@ namespace MongoDB )] public class PaymentServiceWeChatPayMongoDbTestModule : AbpModule { - private static readonly MongoDbRunner MongoDbRunner = MongoDbRunner.Start(); - public override void ConfigureServices(ServiceConfigurationContext context) { - var connectionString = MongoDbRunner.ConnectionString.EnsureEndsWith('/') + - "Db_" + - Guid.NewGuid().ToString("N"); - Configure(options => { - options.ConnectionStrings.Default = connectionString; + options.ConnectionStrings.Default = MongoDbFixture.GetRandomConnectionString(); }); } } diff --git a/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.MongoDB.Tests/MongoDB/WeChatPayMongoDbTestBase.cs b/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.MongoDB.Tests/MongoDB/WeChatPayMongoDbTestBase.cs index b59d6c2a..cc8d40e7 100644 --- a/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.MongoDB.Tests/MongoDB/WeChatPayMongoDbTestBase.cs +++ b/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.MongoDB.Tests/MongoDB/WeChatPayMongoDbTestBase.cs @@ -1,4 +1,4 @@ -namespace MongoDB +namespace EasyAbp.PaymentService.WeChatPay.MongoDB { /* This class can be used as a base class for MongoDB integration tests, * while SampleRepository_Tests uses a different approach. diff --git a/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.TestBase/PaymentServiceWeChatPayTestBaseModule.cs b/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.TestBase/PaymentServiceWeChatPayTestBaseModule.cs index 80ed6980..36076b28 100644 --- a/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.TestBase/PaymentServiceWeChatPayTestBaseModule.cs +++ b/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.TestBase/PaymentServiceWeChatPayTestBaseModule.cs @@ -1,5 +1,4 @@ using EasyAbp.Abp.WeChat.Pay.Options; -using EasyAbp.PaymentService.WeChatPay; using Microsoft.Extensions.DependencyInjection; using Volo.Abp; using Volo.Abp.Authorization; @@ -8,6 +7,8 @@ using Volo.Abp.Modularity; using Volo.Abp.Threading; +namespace EasyAbp.PaymentService.WeChatPay; + [DependsOn( typeof(AbpAutofacModule), typeof(AbpTestBaseModule), diff --git a/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.TestBase/Security/FakeCurrentPrincipalAccessor.cs b/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.TestBase/Security/FakeCurrentPrincipalAccessor.cs index d308fe62..5c533be5 100644 --- a/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.TestBase/Security/FakeCurrentPrincipalAccessor.cs +++ b/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.TestBase/Security/FakeCurrentPrincipalAccessor.cs @@ -3,7 +3,7 @@ using Volo.Abp.DependencyInjection; using Volo.Abp.Security.Claims; -namespace Security +namespace EasyAbp.PaymentService.WeChatPay.Security { [Dependency(ReplaceServices = true)] public class FakeCurrentPrincipalAccessor : ThreadCurrentPrincipalAccessor diff --git a/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.TestBase/WeChatPayDataSeedContributor.cs b/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.TestBase/WeChatPayDataSeedContributor.cs index e7e6e35c..279c1dff 100644 --- a/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.TestBase/WeChatPayDataSeedContributor.cs +++ b/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.TestBase/WeChatPayDataSeedContributor.cs @@ -3,6 +3,8 @@ using Volo.Abp.DependencyInjection; using Volo.Abp.Guids; +namespace EasyAbp.PaymentService.WeChatPay; + public class WeChatPayDataSeedContributor : IDataSeedContributor, ITransientDependency { private readonly IGuidGenerator _guidGenerator; @@ -16,8 +18,8 @@ public WeChatPayDataSeedContributor( public Task SeedAsync(DataSeedContext context) { /* Instead of returning the Task.CompletedTask, you can insert your test data - * at this point! - */ + * at this point! + */ return Task.CompletedTask; } diff --git a/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.TestBase/WeChatPayTestBase.cs b/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.TestBase/WeChatPayTestBase.cs index f930ba50..9700a605 100644 --- a/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.TestBase/WeChatPayTestBase.cs +++ b/modules/EasyAbp.PaymentService.WeChatPay/test/EasyAbp.PaymentService.WeChatPay.TestBase/WeChatPayTestBase.cs @@ -7,6 +7,8 @@ using Volo.Abp.Uow; /* All test classes are derived from this class, directly or indirectly. */ +namespace EasyAbp.PaymentService.WeChatPay; + public abstract class WeChatPayTestBase : AbpIntegratedTest where TStartupModule : IAbpModule { diff --git a/modules/EasyAbp.PaymentService/src/EasyAbp.PaymentService.Domain.Shared/EasyAbp.PaymentService.Domain.Shared.csproj b/modules/EasyAbp.PaymentService/src/EasyAbp.PaymentService.Domain.Shared/EasyAbp.PaymentService.Domain.Shared.csproj index a89609f0..3999dca5 100644 --- a/modules/EasyAbp.PaymentService/src/EasyAbp.PaymentService.Domain.Shared/EasyAbp.PaymentService.Domain.Shared.csproj +++ b/modules/EasyAbp.PaymentService/src/EasyAbp.PaymentService.Domain.Shared/EasyAbp.PaymentService.Domain.Shared.csproj @@ -9,6 +9,7 @@ + diff --git a/modules/EasyAbp.PaymentService/src/EasyAbp.PaymentService.Domain.Shared/EasyAbp/PaymentService/PaymentServiceDomainSharedModule.cs b/modules/EasyAbp.PaymentService/src/EasyAbp.PaymentService.Domain.Shared/EasyAbp/PaymentService/PaymentServiceDomainSharedModule.cs index c48038c0..efbb670a 100644 --- a/modules/EasyAbp.PaymentService/src/EasyAbp.PaymentService.Domain.Shared/EasyAbp/PaymentService/PaymentServiceDomainSharedModule.cs +++ b/modules/EasyAbp.PaymentService/src/EasyAbp.PaymentService.Domain.Shared/EasyAbp/PaymentService/PaymentServiceDomainSharedModule.cs @@ -1,4 +1,5 @@ -using Volo.Abp.Modularity; +using Volo.Abp.Domain; +using Volo.Abp.Modularity; using Volo.Abp.Localization; using EasyAbp.PaymentService.Localization; using Volo.Abp.Localization.ExceptionHandling; @@ -9,7 +10,8 @@ namespace EasyAbp.PaymentService { [DependsOn( - typeof(AbpValidationModule) + typeof(AbpValidationModule), + typeof(AbpDddDomainSharedModule) )] public class PaymentServiceDomainSharedModule : AbpModule { diff --git a/modules/EasyAbp.PaymentService/src/EasyAbp.PaymentService.Web/Menus/PaymentServiceMenuContributor.cs b/modules/EasyAbp.PaymentService/src/EasyAbp.PaymentService.Web/Menus/PaymentServiceMenuContributor.cs index e9bfbcc5..efe912c0 100644 --- a/modules/EasyAbp.PaymentService/src/EasyAbp.PaymentService.Web/Menus/PaymentServiceMenuContributor.cs +++ b/modules/EasyAbp.PaymentService/src/EasyAbp.PaymentService.Web/Menus/PaymentServiceMenuContributor.cs @@ -1,14 +1,10 @@ using System.Collections.Generic; using System.Threading.Tasks; using EasyAbp.PaymentService.Authorization; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Localization; using EasyAbp.PaymentService.Localization; -using EasyAbp.PaymentService.Web.Menus; -using Microsoft.AspNetCore.Authorization; using Volo.Abp.UI.Navigation; -namespace EasyAbp.PaymentService.Web +namespace EasyAbp.PaymentService.Web.Menus { public class PaymentServiceMenuContributor : IMenuContributor { diff --git a/modules/EasyAbp.PaymentService/src/EasyAbp.PaymentService.Web/PaymentServiceWebModule.cs b/modules/EasyAbp.PaymentService/src/EasyAbp.PaymentService.Web/PaymentServiceWebModule.cs index 42d2cbbb..407e799d 100644 --- a/modules/EasyAbp.PaymentService/src/EasyAbp.PaymentService.Web/PaymentServiceWebModule.cs +++ b/modules/EasyAbp.PaymentService/src/EasyAbp.PaymentService.Web/PaymentServiceWebModule.cs @@ -1,6 +1,7 @@ using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.Extensions.DependencyInjection; using EasyAbp.PaymentService.Localization; +using EasyAbp.PaymentService.Web.Menus; using Volo.Abp.AspNetCore.Mvc.Localization; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; using Volo.Abp.AutoMapper; diff --git a/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.Application.Tests/PaymentServiceApplicationTestBase.cs b/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.Application.Tests/PaymentServiceApplicationTestBase.cs index 02844b16..f1942137 100644 --- a/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.Application.Tests/PaymentServiceApplicationTestBase.cs +++ b/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.Application.Tests/PaymentServiceApplicationTestBase.cs @@ -2,6 +2,8 @@ /* Inherit from this class for your application layer tests. * See SampleAppService_Tests for example. */ +namespace EasyAbp.PaymentService; + public abstract class PaymentServiceApplicationTestBase : PaymentServiceTestBase { diff --git a/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.Application.Tests/PaymentServiceApplicationTestModule.cs b/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.Application.Tests/PaymentServiceApplicationTestModule.cs index 0441b9e6..23acd3bc 100644 --- a/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.Application.Tests/PaymentServiceApplicationTestModule.cs +++ b/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.Application.Tests/PaymentServiceApplicationTestModule.cs @@ -1,5 +1,6 @@ -using EasyAbp.PaymentService; -using Volo.Abp.Modularity; +using Volo.Abp.Modularity; + +namespace EasyAbp.PaymentService; [DependsOn( typeof(PaymentServiceApplicationModule), diff --git a/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.Application.Tests/Payments/PaymentAppServiceTests.cs b/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.Application.Tests/Payments/PaymentAppServiceTests.cs index f2d8564e..9a1e745e 100644 --- a/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.Application.Tests/Payments/PaymentAppServiceTests.cs +++ b/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.Application.Tests/Payments/PaymentAppServiceTests.cs @@ -1,14 +1,12 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; -using EasyAbp.PaymentService.Payments; using EasyAbp.PaymentService.Payments.Dtos; using Shouldly; using Volo.Abp.EventBus.Distributed; using Xunit; -namespace Payments +namespace EasyAbp.PaymentService.Payments { public class PaymentAppServiceTests : PaymentServiceApplicationTestBase { diff --git a/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.Application.Tests/Refunds/RefundAppServiceTests.cs b/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.Application.Tests/Refunds/RefundAppServiceTests.cs index 028327b1..2f6493fe 100644 --- a/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.Application.Tests/Refunds/RefundAppServiceTests.cs +++ b/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.Application.Tests/Refunds/RefundAppServiceTests.cs @@ -1,8 +1,7 @@ using System.Threading.Tasks; -using EasyAbp.PaymentService.Refunds; using Xunit; -namespace Refunds +namespace EasyAbp.PaymentService.Refunds { public class RefundAppServiceTests : PaymentServiceApplicationTestBase { diff --git a/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.Domain.Tests/PaymentServiceDomainTestBase.cs b/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.Domain.Tests/PaymentServiceDomainTestBase.cs index 66783ce2..c95ba7ac 100644 --- a/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.Domain.Tests/PaymentServiceDomainTestBase.cs +++ b/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.Domain.Tests/PaymentServiceDomainTestBase.cs @@ -2,6 +2,8 @@ /* Inherit from this class for your domain layer tests. * See SampleManager_Tests for example. */ +namespace EasyAbp.PaymentService; + public abstract class PaymentServiceDomainTestBase : PaymentServiceTestBase { diff --git a/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.Domain.Tests/PaymentServiceDomainTestModule.cs b/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.Domain.Tests/PaymentServiceDomainTestModule.cs index 7e7e7aba..69efadcc 100644 --- a/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.Domain.Tests/PaymentServiceDomainTestModule.cs +++ b/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.Domain.Tests/PaymentServiceDomainTestModule.cs @@ -5,6 +5,8 @@ * You can switch to MongoDB, however your domain tests should be * database independent anyway. */ +namespace EasyAbp.PaymentService; + [DependsOn( typeof(PaymentServiceEntityFrameworkCoreTestModule) )] diff --git a/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.Domain.Tests/Payments/PaymentDomainTests.cs b/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.Domain.Tests/Payments/PaymentDomainTests.cs index 5a1566ef..a2c1ead2 100644 --- a/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.Domain.Tests/Payments/PaymentDomainTests.cs +++ b/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.Domain.Tests/Payments/PaymentDomainTests.cs @@ -1,7 +1,7 @@ using System.Threading.Tasks; using Xunit; -namespace Payments +namespace EasyAbp.PaymentService.Payments { public class PaymentDomainTests : PaymentServiceDomainTestBase { diff --git a/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.Domain.Tests/Refunds/RefundDomainTests.cs b/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.Domain.Tests/Refunds/RefundDomainTests.cs index 316eaf32..5e1924c0 100644 --- a/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.Domain.Tests/Refunds/RefundDomainTests.cs +++ b/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.Domain.Tests/Refunds/RefundDomainTests.cs @@ -1,7 +1,7 @@ using System.Threading.Tasks; using Xunit; -namespace Refunds +namespace EasyAbp.PaymentService.Refunds { public class RefundDomainTests : PaymentServiceDomainTestBase { diff --git a/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.MongoDB.Tests/EasyAbp.PaymentService.MongoDB.Tests.csproj b/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.MongoDB.Tests/EasyAbp.PaymentService.MongoDB.Tests.csproj index f18d8111..209f6b9b 100644 --- a/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.MongoDB.Tests/EasyAbp.PaymentService.MongoDB.Tests.csproj +++ b/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.MongoDB.Tests/EasyAbp.PaymentService.MongoDB.Tests.csproj @@ -7,7 +7,10 @@ - + + + + diff --git a/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.MongoDB.Tests/MongoDB/MongoDbFixture.cs b/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.MongoDB.Tests/MongoDB/MongoDbFixture.cs new file mode 100644 index 00000000..506653f2 --- /dev/null +++ b/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.MongoDB.Tests/MongoDB/MongoDbFixture.cs @@ -0,0 +1,35 @@ +using System; +using EphemeralMongo; + +namespace EasyAbp.PaymentService.MongoDB +{ + public class MongoDbFixture : IDisposable + { + public readonly static IMongoRunner MongoDbRunner; + + static MongoDbFixture() + { + MongoDbRunner = MongoRunner.Run(new MongoRunnerOptions + { + UseSingleNodeReplicaSet = true + }); + } + + public static string GetRandomConnectionString() + { + return GetConnectionString("Db_" + Guid.NewGuid().ToString("N")); + } + + public static string GetConnectionString(string databaseName) + { + var stringArray = MongoDbRunner.ConnectionString.Split('?'); + var connectionString = stringArray[0].EnsureEndsWith('/') + databaseName + "/?" + stringArray[1]; + return connectionString; + } + + public void Dispose() + { + MongoDbRunner?.Dispose(); + } + } +} diff --git a/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.MongoDB.Tests/MongoDB/MongoTestCollection.cs b/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.MongoDB.Tests/MongoDB/MongoTestCollection.cs new file mode 100644 index 00000000..771b0263 --- /dev/null +++ b/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.MongoDB.Tests/MongoDB/MongoTestCollection.cs @@ -0,0 +1,10 @@ +using Xunit; + +namespace EasyAbp.PaymentService.MongoDB +{ + [CollectionDefinition(Name)] + public class MongoTestCollection : ICollectionFixture + { + public const string Name = "MongoDB Collection"; + } +} \ No newline at end of file diff --git a/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.MongoDB.Tests/MongoDB/PaymentServiceMongoDbTestBase.cs b/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.MongoDB.Tests/MongoDB/PaymentServiceMongoDbTestBase.cs index 95864f5c..9b69acc6 100644 --- a/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.MongoDB.Tests/MongoDB/PaymentServiceMongoDbTestBase.cs +++ b/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.MongoDB.Tests/MongoDB/PaymentServiceMongoDbTestBase.cs @@ -1,4 +1,4 @@ -namespace MongoDB +namespace EasyAbp.PaymentService.MongoDB { /* This class can be used as a base class for MongoDB integration tests, * while SampleRepository_Tests uses a different approach. diff --git a/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.MongoDB.Tests/MongoDB/PaymentServiceMongoDbTestModule.cs b/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.MongoDB.Tests/MongoDB/PaymentServiceMongoDbTestModule.cs index b913becd..30fd288d 100644 --- a/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.MongoDB.Tests/MongoDB/PaymentServiceMongoDbTestModule.cs +++ b/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.MongoDB.Tests/MongoDB/PaymentServiceMongoDbTestModule.cs @@ -1,10 +1,7 @@ -using System; -using EasyAbp.PaymentService.MongoDB; -using Mongo2Go; -using Volo.Abp.Data; +using Volo.Abp.Data; using Volo.Abp.Modularity; -namespace MongoDB +namespace EasyAbp.PaymentService.MongoDB { [DependsOn( typeof(PaymentServiceTestBaseModule), @@ -12,17 +9,11 @@ namespace MongoDB )] public class PaymentServiceMongoDbTestModule : AbpModule { - private static readonly MongoDbRunner MongoDbRunner = MongoDbRunner.Start(); - public override void ConfigureServices(ServiceConfigurationContext context) { - var connectionString = MongoDbRunner.ConnectionString.EnsureEndsWith('/') + - "Db_" + - Guid.NewGuid().ToString("N"); - Configure(options => { - options.ConnectionStrings.Default = connectionString; + options.ConnectionStrings.Default = MongoDbFixture.GetRandomConnectionString(); }); } } diff --git a/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.TestBase/PaymentServiceDataSeedContributor.cs b/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.TestBase/PaymentServiceDataSeedContributor.cs index 12f69a7b..57df14e5 100644 --- a/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.TestBase/PaymentServiceDataSeedContributor.cs +++ b/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.TestBase/PaymentServiceDataSeedContributor.cs @@ -3,6 +3,8 @@ using Volo.Abp.DependencyInjection; using Volo.Abp.Guids; +namespace EasyAbp.PaymentService; + public class PaymentServiceDataSeedContributor : IDataSeedContributor, ITransientDependency { private readonly IGuidGenerator _guidGenerator; @@ -16,8 +18,8 @@ public PaymentServiceDataSeedContributor( public Task SeedAsync(DataSeedContext context) { /* Instead of returning the Task.CompletedTask, you can insert your test data - * at this point! - */ + * at this point! + */ return Task.CompletedTask; } diff --git a/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.TestBase/PaymentServiceTestBase.cs b/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.TestBase/PaymentServiceTestBase.cs index 571ecfab..977d7c43 100644 --- a/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.TestBase/PaymentServiceTestBase.cs +++ b/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.TestBase/PaymentServiceTestBase.cs @@ -7,6 +7,8 @@ using Volo.Abp.Uow; /* All test classes are derived from this class, directly or indirectly. */ +namespace EasyAbp.PaymentService; + public abstract class PaymentServiceTestBase : AbpIntegratedTest where TStartupModule : IAbpModule { diff --git a/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.TestBase/PaymentServiceTestBaseModule.cs b/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.TestBase/PaymentServiceTestBaseModule.cs index e4cf2cb1..157c2327 100644 --- a/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.TestBase/PaymentServiceTestBaseModule.cs +++ b/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.TestBase/PaymentServiceTestBaseModule.cs @@ -1,5 +1,4 @@ -using EasyAbp.PaymentService; -using EasyAbp.PaymentService.Options; +using EasyAbp.PaymentService.Options; using EasyAbp.PaymentService.Payments; using Microsoft.Extensions.DependencyInjection; using Volo.Abp; @@ -9,6 +8,8 @@ using Volo.Abp.Modularity; using Volo.Abp.Threading; +namespace EasyAbp.PaymentService; + [DependsOn( typeof(AbpAutofacModule), typeof(AbpTestBaseModule), diff --git a/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.TestBase/Security/FakeCurrentPrincipalAccessor.cs b/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.TestBase/Security/FakeCurrentPrincipalAccessor.cs index d308fe62..a9fbe419 100644 --- a/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.TestBase/Security/FakeCurrentPrincipalAccessor.cs +++ b/modules/EasyAbp.PaymentService/test/EasyAbp.PaymentService.TestBase/Security/FakeCurrentPrincipalAccessor.cs @@ -3,7 +3,7 @@ using Volo.Abp.DependencyInjection; using Volo.Abp.Security.Claims; -namespace Security +namespace EasyAbp.PaymentService.Security { [Dependency(ReplaceServices = true)] public class FakeCurrentPrincipalAccessor : ThreadCurrentPrincipalAccessor diff --git a/samples/PaymentServiceSample/aspnet-core/src/PaymentServiceSample.Web/PaymentServiceSample.Web.csproj b/samples/PaymentServiceSample/aspnet-core/src/PaymentServiceSample.Web/PaymentServiceSample.Web.csproj index 2d21c1fb..d0a67718 100644 --- a/samples/PaymentServiceSample/aspnet-core/src/PaymentServiceSample.Web/PaymentServiceSample.Web.csproj +++ b/samples/PaymentServiceSample/aspnet-core/src/PaymentServiceSample.Web/PaymentServiceSample.Web.csproj @@ -45,7 +45,7 @@ - + diff --git a/samples/PaymentServiceSample/aspnet-core/src/PaymentServiceSample.Web/package.json b/samples/PaymentServiceSample/aspnet-core/src/PaymentServiceSample.Web/package.json index 330a0b36..24d9c858 100644 --- a/samples/PaymentServiceSample/aspnet-core/src/PaymentServiceSample.Web/package.json +++ b/samples/PaymentServiceSample/aspnet-core/src/PaymentServiceSample.Web/package.json @@ -3,6 +3,6 @@ "name": "my-app", "private": true, "dependencies": { - "@abp/aspnetcore.mvc.ui.theme.leptonxlite": "~2.2.0-rc.1" + "@abp/aspnetcore.mvc.ui.theme.leptonxlite": "~2.3.0" } } \ No newline at end of file diff --git a/samples/PaymentServiceSample/aspnet-core/src/PaymentServiceSample.Web/yarn.lock b/samples/PaymentServiceSample/aspnet-core/src/PaymentServiceSample.Web/yarn.lock index b74ede02..fa65a449 100644 --- a/samples/PaymentServiceSample/aspnet-core/src/PaymentServiceSample.Web/yarn.lock +++ b/samples/PaymentServiceSample/aspnet-core/src/PaymentServiceSample.Web/yarn.lock @@ -2,10 +2,10 @@ # yarn lockfile v1 -"@abp/aspnetcore.mvc.ui.theme.leptonxlite@~2.2.0-rc.1": - version "2.2.0" - resolved "https://registry.npmmirror.com/@abp/aspnetcore.mvc.ui.theme.leptonxlite/-/aspnetcore.mvc.ui.theme.leptonxlite-2.2.0.tgz#dc76d1d869e16876288c90f5fec31df3a99bb628" - integrity sha512-mAAptSqGWQu+GefI1XHlP7KF8PncWreuC9u09rUdZ1cixFURy7PaG/n/QMNj9YJSVIb+vPsnFjYDeTtNbrxU/g== +"@abp/aspnetcore.mvc.ui.theme.leptonxlite@~2.3.0": + version "2.3.0" + resolved "https://registry.npmmirror.com/@abp/aspnetcore.mvc.ui.theme.leptonxlite/-/aspnetcore.mvc.ui.theme.leptonxlite-2.3.0.tgz#7e05ce2a897de0f0bb016e0ae4a9adfd0260e7be" + integrity sha512-d7p8Pv6g8aocjBIBKHMF8fFDeVzWqkriz6uKy3oowCKSe5tqzq3j35Um7kEu7DapPf9MyBPq8+z9VsGbxJCjww== dependencies: "@abp/aspnetcore.mvc.ui.theme.shared" "~7.2.1"