using Shentun.Sms.Client; using Shentun.WebPeis.Enums; using Shentun.WebPeis.Models; using Shentun.WebPeis.Persons; using Shentun.WebPeis.Wechats; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; using Volo.Abp.Modularity; using Volo.Abp.Uow; using Xunit; using Xunit.Abstractions; namespace Shentun.WebPeis { public abstract class PersonAppServiceTest : WebPeisApplicationTestBase where TStartupModule : IAbpModule { private readonly IRepository _repository; private readonly PersonAppService _appService; private readonly ITestOutputHelper _output; private readonly IUnitOfWorkManager _unitOfWorkManager; public PersonAppServiceTest(ITestOutputHelper output) { //ITestOutputHelper testOutputHelper //_output = testOutputHelper; _unitOfWorkManager = GetRequiredService(); _repository = GetRequiredService>(); _appService = GetRequiredService(); _output = output; } [Fact] public async Task GetWechatUserTokenAsync() { using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true)) { var entity = new WechatUserJsCodeInputDto() { JsCode = "0c1yTa0w3mErQ23eot3w3ocsxw4yTa0P" }; var newEntity = await _appService.WeChatUserLoginAsync(entity); await unitOfWork.CompleteAsync(); } } [Fact] public async Task CreateAsync() { using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true)) { var entity = new CreatePersonDto() { JsCode = "0f1XjtHa1yzivH0rmsHa1FuJf32XjtHL", PersonName = "张三", MobileTelephone = "18911254911", MedicalCenterId = new Guid("150da355-dfbf-466b-9697-355836a862c4"), IdNo = "43062419790909931X", SexId = SexFlag.Male, WechatOpenId = "obZGv5RhSNxxpkDwT0Xaf9Fzn8NM", MaritalStatusId = MaritalStatusFlag.Married, }; var newEntity = await _appService.CreateAsync(entity); await unitOfWork.CompleteAsync(); } } [Fact] public async Task GetPersonKinshipList() { using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true)) { var entityList = await _appService.GetPersonKinshipList(); foreach (var entity in entityList) { _output.WriteLine(entity.PersonName); } await unitOfWork.CompleteAsync(); } } [Fact] public async Task SendVerifySms() { using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true)) { var createSmsTaskDto = new CreateSmsTaskDto() { MobileTelephone = "18911254911", CountryCode = "86", PersonId = "0001", PersonName = "张三" }; await _appService.SendVerifySms(createSmsTaskDto); } } } }