using Shentun.WebPeis.Asbitems; using Shentun.WebPeis.Models; using Shentun.WebPeis.Persons; using Shentun.WebPeis.QuestionRegisters; 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 class QuestionRegisterAppServiceTest : WebPeisApplicationTestBase where TStartupModule : IAbpModule { private readonly IRepository _repository; private readonly QuestionRegisterAppService _appService; private readonly ITestOutputHelper _output; private readonly IUnitOfWorkManager _unitOfWorkManager; public QuestionRegisterAppServiceTest(ITestOutputHelper output) { _unitOfWorkManager = GetRequiredService(); _repository = GetRequiredService>(); _appService = GetRequiredService(); _output = output; } [Fact] public async Task GetByPersonId() { using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true)) { var entity = await _appService.GetByPersonIdAsync(new PersonIdInputDto() { PersonId = new Guid("3a12d7fa-63f1-d549-c2f8-01123e5b7a8a") }); foreach (var item in entity.QuestionRegisterItems) { _output.WriteLine("-----------" + item.QuestionName + "-" + item.AnswerType ); foreach (var answer in item.QuestionRegisterAnswers) { _output.WriteLine(answer.QuestionAnswerName + "-" + answer.ChildAnswerType ); answer.IsSelected = 'Y'; foreach(var childAnswer in answer.Childs) { _output.WriteLine("----"+childAnswer.QuestionAnswerName ); childAnswer.IsSelected = 'Y'; } } } await _appService.UpdateAsync( entity ); await unitOfWork.CompleteAsync(); } } } }