|
@@ -30,6 +30,7 @@ using System;
|
|
|
using DocumentFormat.OpenXml.Bibliography;
|
|
|
using Hotline.Snapshot;
|
|
|
using Hotline.Share.Enums.Settings;
|
|
|
+using Npgsql;
|
|
|
|
|
|
namespace Hotline.Tests.Mock;
|
|
|
public class OrderServiceMock
|
|
@@ -130,7 +131,21 @@ public class OrderServiceMock
|
|
|
AddOrderDto.Title = "单元测试" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
|
|
|
if (tags.NotNullOrEmpty())
|
|
|
AddOrderDto.Tags = tags;
|
|
|
- CreateOrderOutDto = _orderController.Add(AddOrderDto).GetAwaiter().GetResult().ToJson().FromJson<CreateOrderOutDto>();
|
|
|
+ RetryHelper.Retry(() =>
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ CreateOrderOutDto = _orderController.Add(AddOrderDto).GetAwaiter().GetResult().ToJson().FromJson<CreateOrderOutDto>();
|
|
|
+ }
|
|
|
+ catch (PostgresException e)
|
|
|
+ {
|
|
|
+ if (e.Message.Contains("unique_order_no"))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }, 10);
|
|
|
_orderServiceStartWorkflow.orderServiceMock = this;
|
|
|
return _orderServiceStartWorkflow;
|
|
|
}
|
|
@@ -657,7 +672,7 @@ public class OrderServiceMock
|
|
|
return this;
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public string 申请延期(Action action = null)
|
|
|
{
|
|
|
action?.Invoke();
|
|
@@ -669,7 +684,7 @@ public class OrderServiceMock
|
|
|
{
|
|
|
NextStepCode = step.Key,
|
|
|
NextStepName = step.Value,
|
|
|
- NextHandlers = new List<StepAssignInfo>{step.Items.First()},
|
|
|
+ NextHandlers = new List<StepAssignInfo> { step.Items.First() },
|
|
|
Opinion = "单元测试延期申请",
|
|
|
FlowDirection = step.FlowDirection,
|
|
|
BackToCountersignEnd = step.BackToCountersignEnd,
|