|
@@ -9,33 +9,48 @@ using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
+using XF.Domain.Repository;
|
|
|
|
|
|
namespace Hotline.Application.Tests.Repository;
|
|
|
public class OrderVisitRepositoryTest
|
|
|
{
|
|
|
private readonly IOrderVisitRepository _orderVisitRepository;
|
|
|
+ private readonly IRepository<OrderVisitDetail> _orderVisitDetailRepository;
|
|
|
|
|
|
- public OrderVisitRepositoryTest(IOrderVisitRepository orderVisitRepository)
|
|
|
+ public OrderVisitRepositoryTest(IOrderVisitRepository orderVisitRepository, IRepository<OrderVisitDetail> orderVisitDetailRepository)
|
|
|
{
|
|
|
_orderVisitRepository = orderVisitRepository;
|
|
|
+ _orderVisitDetailRepository = orderVisitDetailRepository;
|
|
|
}
|
|
|
|
|
|
[Theory]
|
|
|
- [InlineData("4", "SMSUnsatisfied")]
|
|
|
- [InlineData("1", "Visited")]
|
|
|
- public async Task UpdateSmsReply_Test(string content, string visitState)
|
|
|
+ [InlineData("4", "SMSUnsatisfied", "不满意")]
|
|
|
+ [InlineData("1", "Visited", "非常满意")]
|
|
|
+ public async Task UpdateSmsReply_Test(string content, string visitState, string orgResuktValue)
|
|
|
{
|
|
|
var visit = await _orderVisitRepository.Queryable()
|
|
|
.Where(m => m.VisitState == EVisitState.SMSVisiting)
|
|
|
.OrderByDescending(m => m.CreationTime)
|
|
|
.FirstAsync();
|
|
|
|
|
|
- var dto = new PushReceiveMessageDto { ExternalId = visit.Id , IsSmsReply = true, SmsReplyContent = content };
|
|
|
+ var dto = new PushReceiveMessageDto { ExternalId = visit.Id, IsSmsReply = true, SmsReplyContent = content };
|
|
|
var message = new Message();
|
|
|
await _orderVisitRepository.UpdateSmsReplyAsync(dto, message);
|
|
|
visit = _orderVisitRepository.Get(visit.Id);
|
|
|
visit.VisitState.ShouldBe(visitState.ToEnum<EVisitState>());
|
|
|
+ visit.NowEvaluate.Key.ShouldBe(content);
|
|
|
+ visit.NowEvaluate.Value.ShouldBe(orgResuktValue);
|
|
|
+
|
|
|
if (content == "4" || content == "5")
|
|
|
visit.VisitType.ShouldBeNull();
|
|
|
+
|
|
|
+ var org = await _orderVisitDetailRepository.Queryable()
|
|
|
+ .Where(m => m.VisitId == visit.Id && m.VisitTarget == EVisitTarget.Org)
|
|
|
+ .FirstAsync();
|
|
|
+ org.OrgProcessingResults.Key.ShouldBe(content);
|
|
|
+ org.OrgProcessingResults.Value.ShouldBe(orgResuktValue);
|
|
|
+ org.OrgHandledAttitude.Key.ShouldBe(content);
|
|
|
+ org.OrgHandledAttitude.Value.ShouldBe(orgResuktValue);
|
|
|
+
|
|
|
}
|
|
|
}
|