You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
2.1 KiB
59 lines
2.1 KiB
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<TStartupModule> : WebPeisApplicationTestBase<TStartupModule>
|
|
where TStartupModule : IAbpModule
|
|
{
|
|
private readonly IRepository<QuestionRegister> _repository;
|
|
private readonly QuestionRegisterAppService _appService;
|
|
private readonly ITestOutputHelper _output;
|
|
private readonly IUnitOfWorkManager _unitOfWorkManager;
|
|
public QuestionRegisterAppServiceTest(ITestOutputHelper output)
|
|
{
|
|
_unitOfWorkManager = GetRequiredService<IUnitOfWorkManager>();
|
|
_repository = GetRequiredService<IRepository<QuestionRegister>>();
|
|
_appService = GetRequiredService<QuestionRegisterAppService>();
|
|
_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);
|
|
foreach (var answer in item.QuestionRegisterAnswers)
|
|
{
|
|
_output.WriteLine(answer.QuestionAnswerName);
|
|
foreach(var childAnswer in answer.Childs)
|
|
{
|
|
_output.WriteLine("----"+childAnswer.QuestionAnswerName);
|
|
}
|
|
}
|
|
}
|
|
await unitOfWork.CompleteAsync();
|
|
}
|
|
}
|
|
}
|
|
}
|