From 7e160fa0aaa57f232443780a0e2be16548ec12aa Mon Sep 17 00:00:00 2001 From: Jadyn Date: Sun, 17 Jul 2022 12:23:34 +0800 Subject: [PATCH] Fix typo --- .../{CreateOrderDto.cs => CreateOrderResultDto.cs} | 2 +- .../FlashSalePlans/IFlashSalePlanAppService.cs | 2 +- .../FlashSalePlans/FlashSalePlanAppService.cs | 6 +++--- ...kenCreateFlashSaleOrderCompleteEventHandler.cs} | 8 ++++---- .../FlashSalePlans/FlashSalePlanController.cs | 2 +- .../FlashSalePlans/FlashSalePlanAppServiceTests.cs | 14 +++++++------- ...reateFlashSaleOrderCompleteEventHandlerTest.cs} | 14 ++++---------- 7 files changed, 21 insertions(+), 27 deletions(-) rename plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application.Contracts/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/Dtos/{CreateOrderDto.cs => CreateOrderResultDto.cs} (78%) rename plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/{RollBackInventoryCreateFlashSaleOrderCompleteEventHandler.cs => ProcessInvalidHashTokenCreateFlashSaleOrderCompleteEventHandler.cs} (85%) rename plugins/FlashSales/test/EasyAbp.EShop.Plugins.FlashSales.Application.Tests/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/{RollBackInventoryCreateFlashSaleOrderCompleteEventHandlerTest.cs => ProcessInvalidHashTokenCreateFlashSaleOrderCompleteEventHandlerTest.cs} (93%) diff --git a/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application.Contracts/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/Dtos/CreateOrderDto.cs b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application.Contracts/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/Dtos/CreateOrderResultDto.cs similarity index 78% rename from plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application.Contracts/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/Dtos/CreateOrderDto.cs rename to plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application.Contracts/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/Dtos/CreateOrderResultDto.cs index e3f54829..418e04af 100644 --- a/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application.Contracts/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/Dtos/CreateOrderDto.cs +++ b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application.Contracts/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/Dtos/CreateOrderResultDto.cs @@ -3,7 +3,7 @@ using Volo.Abp.Application.Dtos; namespace EasyAbp.EShop.Plugins.FlashSales.FlashSalePlans.Dtos; -public class CreateOrderDto : ExtensibleEntityDto +public class CreateOrderResultDto : ExtensibleEntityDto { public bool IsSuccess { get; set; } diff --git a/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application.Contracts/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/IFlashSalePlanAppService.cs b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application.Contracts/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/IFlashSalePlanAppService.cs index 55b211ea..d98fe61f 100644 --- a/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application.Contracts/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/IFlashSalePlanAppService.cs +++ b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application.Contracts/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/IFlashSalePlanAppService.cs @@ -15,5 +15,5 @@ public interface IFlashSalePlanAppService : { Task PreOrderAsync(Guid id); - Task OrderAsync(Guid id, CreateOrderInput input); + Task OrderAsync(Guid id, CreateOrderInput input); } diff --git a/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/FlashSalePlanAppService.cs b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/FlashSalePlanAppService.cs index 257d88b1..056b2edf 100644 --- a/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/FlashSalePlanAppService.cs +++ b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/FlashSalePlanAppService.cs @@ -216,7 +216,7 @@ public class FlashSalePlanAppService : return new FlashSalePlanPreOrderDto { ExpiresTime = Clock.Normalize(expiresTime.LocalDateTime), ExpiresInSeconds = Options.PreOrderExpires.TotalSeconds }; } - public virtual async Task OrderAsync(Guid id, CreateOrderInput input) + public virtual async Task OrderAsync(Guid id, CreateOrderInput input) { var preOrderCache = await GetPreOrderCacheAsync(id); if (preOrderCache == null) @@ -259,7 +259,7 @@ public class FlashSalePlanAppService : plan.TenantId, preOrderCache.InventoryProviderName, plan.StoreId, plan.ProductId, plan.ProductSkuId, 1, true)) { - return new CreateOrderDto() { IsSuccess = false }; + return new CreateOrderResultDto() { IsSuccess = false }; } var result = await CreatePendingFlashSaleResultAsync(plan, userId, async (existsResultId) => @@ -278,7 +278,7 @@ public class FlashSalePlanAppService : await DistributedEventBus.PublishAsync(createFlashSaleOrderEto); - return new CreateOrderDto() { IsSuccess = true, FlashSaleResultId = result.Id }; + return new CreateOrderResultDto() { IsSuccess = true, FlashSaleResultId = result.Id }; } #region PreOrderCache diff --git a/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/RollBackInventoryCreateFlashSaleOrderCompleteEventHandler.cs b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/ProcessInvalidHashTokenCreateFlashSaleOrderCompleteEventHandler.cs similarity index 85% rename from plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/RollBackInventoryCreateFlashSaleOrderCompleteEventHandler.cs rename to plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/ProcessInvalidHashTokenCreateFlashSaleOrderCompleteEventHandler.cs index 6aad2f50..7068b989 100644 --- a/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/RollBackInventoryCreateFlashSaleOrderCompleteEventHandler.cs +++ b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/ProcessInvalidHashTokenCreateFlashSaleOrderCompleteEventHandler.cs @@ -10,20 +10,20 @@ using Volo.Abp.EventBus.Distributed; namespace EasyAbp.EShop.Plugins.FlashSales.FlashSalePlans; -public class RollBackInventoryCreateFlashSaleOrderCompleteEventHandler : IDistributedEventHandler, ITransientDependency +public class ProcessInvalidHashTokenCreateFlashSaleOrderCompleteEventHandler : IDistributedEventHandler, ITransientDependency { protected IFlashSaleInventoryManager FlashSaleInventoryManager { get; } protected IDistributedCache DistributedCache { get; } protected IFlashSalePlanRepository FlashSalePlanRepository { get; } protected IProductAppService ProductAppService { get; } - protected ILogger Logger { get; } + protected ILogger Logger { get; } - public RollBackInventoryCreateFlashSaleOrderCompleteEventHandler( + public ProcessInvalidHashTokenCreateFlashSaleOrderCompleteEventHandler( IFlashSaleInventoryManager flashSaleInventoryManager, IDistributedCache distributedCache, IFlashSalePlanRepository flashSalePlanRepository, IProductAppService productAppService, - ILogger logger) + ILogger logger) { FlashSaleInventoryManager = flashSaleInventoryManager; DistributedCache = distributedCache; diff --git a/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.HttpApi/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/FlashSalePlanController.cs b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.HttpApi/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/FlashSalePlanController.cs index c0cd3732..424f9dc2 100644 --- a/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.HttpApi/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/FlashSalePlanController.cs +++ b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.HttpApi/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/FlashSalePlanController.cs @@ -58,7 +58,7 @@ public class FlashSalePlanController : } [HttpPost("{id}/order")] - public virtual Task OrderAsync(Guid id, CreateOrderInput input) + public virtual Task OrderAsync(Guid id, CreateOrderInput input) { return Service.OrderAsync(id, input); } diff --git a/plugins/FlashSales/test/EasyAbp.EShop.Plugins.FlashSales.Application.Tests/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/FlashSalePlanAppServiceTests.cs b/plugins/FlashSales/test/EasyAbp.EShop.Plugins.FlashSales.Application.Tests/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/FlashSalePlanAppServiceTests.cs index ccdc05ea..59167758 100644 --- a/plugins/FlashSales/test/EasyAbp.EShop.Plugins.FlashSales.Application.Tests/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/FlashSalePlanAppServiceTests.cs +++ b/plugins/FlashSales/test/EasyAbp.EShop.Plugins.FlashSales.Application.Tests/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/FlashSalePlanAppServiceTests.cs @@ -140,7 +140,7 @@ public class FlashSalePlanAppServiceTests : FlashSalesApplicationTestBase } [Fact] - public async Task CreateAsync_Should_Throw_Expcetion_When_Validate_Product_Failed() + public async Task CreateAsync_Should_Throw_Exception_When_Validate_Product_Failed() { var createDto = new FlashSalePlanCreateDto() { @@ -197,7 +197,7 @@ public class FlashSalePlanAppServiceTests : FlashSalesApplicationTestBase } [Fact] - public async Task UpdateAsync_Should_Throw_Expcetion_When_Validate_Product_Failed() + public async Task UpdateAsync_Should_Throw_Exception_When_Validate_Product_Failed() { var createDto = new FlashSalePlanCreateDto() { @@ -230,7 +230,7 @@ public class FlashSalePlanAppServiceTests : FlashSalesApplicationTestBase } [Fact] - public async Task UpdateAsync_Should_Throw_Expcetion_When_Has_Result_And_Change_Product() + public async Task UpdateAsync_Should_Throw_Exception_When_Has_Result_And_Change_Product() { var createDto = new FlashSalePlanCreateDto() { @@ -274,7 +274,7 @@ public class FlashSalePlanAppServiceTests : FlashSalesApplicationTestBase } [Fact] - public async Task DeleteAsync_Should_Throw_Expcetion_When_Has_Result() + public async Task DeleteAsync_Should_Throw_Exception_When_Has_Result() { var createDto = new FlashSalePlanCreateDto() { @@ -362,10 +362,10 @@ public class FlashSalePlanAppServiceTests : FlashSalesApplicationTestBase }; await AppService.PreOrderAsync(plan.Id); - var isSucess = await AppService.OrderAsync(plan.Id, createOrderInput); + var createOrderDto = await AppService.OrderAsync(plan.Id, createOrderInput); - isSucess.IsSuccess.ShouldBe(true); - isSucess.FlashSaleResultId.ShouldNotBeNull(); + createOrderDto.IsSuccess.ShouldBe(true); + createOrderDto.FlashSaleResultId.ShouldNotBeNull(); await DistributedEventBus.Received().PublishAsync(Arg.Is(eto => eto.TenantId == plan.TenantId && eto.StoreId == plan.StoreId && diff --git a/plugins/FlashSales/test/EasyAbp.EShop.Plugins.FlashSales.Application.Tests/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/RollBackInventoryCreateFlashSaleOrderCompleteEventHandlerTest.cs b/plugins/FlashSales/test/EasyAbp.EShop.Plugins.FlashSales.Application.Tests/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/ProcessInvalidHashTokenCreateFlashSaleOrderCompleteEventHandlerTest.cs similarity index 93% rename from plugins/FlashSales/test/EasyAbp.EShop.Plugins.FlashSales.Application.Tests/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/RollBackInventoryCreateFlashSaleOrderCompleteEventHandlerTest.cs rename to plugins/FlashSales/test/EasyAbp.EShop.Plugins.FlashSales.Application.Tests/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/ProcessInvalidHashTokenCreateFlashSaleOrderCompleteEventHandlerTest.cs index 164faa82..e5de418b 100644 --- a/plugins/FlashSales/test/EasyAbp.EShop.Plugins.FlashSales.Application.Tests/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/RollBackInventoryCreateFlashSaleOrderCompleteEventHandlerTest.cs +++ b/plugins/FlashSales/test/EasyAbp.EShop.Plugins.FlashSales.Application.Tests/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/ProcessInvalidHashTokenCreateFlashSaleOrderCompleteEventHandlerTest.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Threading.Tasks; using EasyAbp.Eshop.Products.Products; using EasyAbp.EShop.Plugins.FlashSales.FlashSaleResults; @@ -13,17 +10,14 @@ using Microsoft.Extensions.DependencyInjection.Extensions; using NSubstitute; using NSubstitute.ReceivedExtensions; using Shouldly; -using Volo.Abp; -using Volo.Abp.Caching; -using Volo.Abp.EventBus.Distributed; using Volo.Abp.Users; using Xunit; namespace EasyAbp.EShop.Plugins.FlashSales.FlashSalePlans; -public class RollBackInventoryCreateFlashSaleOrderCompleteEventHandlerTest : FlashSalesApplicationTestBase +public class ProcessInvalidHashTokenCreateFlashSaleOrderCompleteEventHandlerTest : FlashSalesApplicationTestBase { - protected RollBackInventoryCreateFlashSaleOrderCompleteEventHandler EventHandler { get; } + protected ProcessInvalidHashTokenCreateFlashSaleOrderCompleteEventHandler EventHandler { get; } protected IDistributedCache DistributedCache { get; } @@ -31,9 +25,9 @@ public class RollBackInventoryCreateFlashSaleOrderCompleteEventHandlerTest : Fla private ProductDto Product1 { get; set; } - public RollBackInventoryCreateFlashSaleOrderCompleteEventHandlerTest() + public ProcessInvalidHashTokenCreateFlashSaleOrderCompleteEventHandlerTest() { - EventHandler = GetRequiredService(); + EventHandler = GetRequiredService(); DistributedCache = GetRequiredService(); FlashSaleInventoryManager = GetRequiredService(); }