|
@@ -98,6 +98,7 @@ public class DefaultCallApplicationTest : TestBase
|
|
|
|
|
|
/// <summary>
|
|
|
/// 测试三方通话后, 工单保存时没有关联到正确的通话记录, 使用本方法能不能修复
|
|
|
+ /// 测试如果通话记录有两通都是呼入的,就不需要修复了
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
[Fact]
|
|
@@ -108,6 +109,7 @@ public class DefaultCallApplicationTest : TestBase
|
|
|
.With(m => m.Id, Ulid.NewUlid().ToString())
|
|
|
.With(m => m.CallNo, callNo)
|
|
|
.With(m => m.Direction, ECallDirection.In)
|
|
|
+ .With(m => m.IsDeleted, false)
|
|
|
.Create();
|
|
|
await _callNativeRepository.AddAsync(inDto);
|
|
|
|
|
@@ -115,6 +117,7 @@ public class DefaultCallApplicationTest : TestBase
|
|
|
.With(m => m.Id, Ulid.NewUlid().ToString())
|
|
|
.With(m => m.Direction, ECallDirection.Out)
|
|
|
.With(m => m.CallNo, callNo)
|
|
|
+ .With(m => m.IsDeleted, false)
|
|
|
.Create();
|
|
|
await _callNativeRepository.AddAsync(inDto2);
|
|
|
|
|
@@ -132,6 +135,42 @@ public class DefaultCallApplicationTest : TestBase
|
|
|
await _defaultCallApplication.OrderRelateCallHandlerAsync(orderId, CancellationToken.None);
|
|
|
(await _orderRepository.Queryable().Where(m => m.Id == orderId).Select(m => m.CallId).FirstAsync())
|
|
|
.ShouldBe(inDto.Id);
|
|
|
+
|
|
|
+ // 测试如果通话记录有两通都是呼入的,就不需要修复了
|
|
|
+
|
|
|
+ callNo = DateTime.Now.ToString("yyyyMMddhhmmss") + "Flow";
|
|
|
+ inDto = _fixture.Build<CallNative>()
|
|
|
+ .With(m => m.Id, Ulid.NewUlid().ToString())
|
|
|
+ .With(m => m.CallNo, callNo)
|
|
|
+ .With(m => m.Direction, ECallDirection.In)
|
|
|
+ .With(m => m.Duration, 20)
|
|
|
+ .With(m => m.IsDeleted, false)
|
|
|
+ .Create();
|
|
|
+ await _callNativeRepository.AddAsync(inDto);
|
|
|
+
|
|
|
+ inDto2 = _fixture.Build<CallNative>()
|
|
|
+ .With(m => m.Id, Ulid.NewUlid().ToString())
|
|
|
+ .With(m => m.Direction, ECallDirection.In)
|
|
|
+ .With(m => m.CallNo, callNo)
|
|
|
+ .With(m => m.Duration, 10)
|
|
|
+ .With(m => m.IsDeleted, false)
|
|
|
+ .Create();
|
|
|
+ await _callNativeRepository.AddAsync(inDto2);
|
|
|
+
|
|
|
+ orderId = await _orderRepository.Queryable()
|
|
|
+ .Where(m => string.IsNullOrEmpty(m.CallId))
|
|
|
+ .OrderByDescending(m => m.CreationTime)
|
|
|
+ .Select(m => m.Id)
|
|
|
+ .FirstAsync();
|
|
|
+
|
|
|
+ await _orderRepository.Updateable()
|
|
|
+ .SetColumns(m => m.CallId == inDto2.Id)
|
|
|
+ .Where(m => m.Id == orderId)
|
|
|
+ .ExecuteCommandAsync();
|
|
|
+
|
|
|
+ await _defaultCallApplication.OrderRelateCallHandlerAsync(orderId, CancellationToken.None);
|
|
|
+ (await _orderRepository.Queryable().Where(m => m.Id == orderId).Select(m => m.CallId).FirstAsync())
|
|
|
+ .ShouldBe(inDto2.Id);
|
|
|
}
|
|
|
|
|
|
//[Fact]
|