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.

81 lines
3.0 KiB

2 years ago
  1. using Shentun.Peis.AppointPatientRegisters;
  2. using Shentun.Peis.ChargeRequests;
  3. using Shentun.Peis.Models;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using Volo.Abp.Domain.Repositories;
  10. using Volo.Abp.Uow;
  11. using Xunit;
  12. using Xunit.Abstractions;
  13. namespace Shentun.Peis
  14. {
  15. public class AppointPatientRegisterAppServiceTest : PeisApplicationTestBase
  16. {
  17. private readonly IRepository<ChargeRequest, Guid> _repository;
  18. private readonly AppointPatientRegisterAppService _appService;
  19. private readonly ITestOutputHelper _output;
  20. private readonly IUnitOfWorkManager _unitOfWorkManager;
  21. public AppointPatientRegisterAppServiceTest(ITestOutputHelper testOutputHelper)
  22. {
  23. _output = testOutputHelper;
  24. _unitOfWorkManager = GetRequiredService<IUnitOfWorkManager>();
  25. _repository = GetRequiredService<IRepository<ChargeRequest, Guid>>();
  26. _appService = GetRequiredService<AppointPatientRegisterAppService>();
  27. }
  28. [Fact]
  29. public async Task GetListByFilterAsync()
  30. {
  31. using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
  32. {
  33. var entity = new AppointPatientRegisterInputDto()
  34. {
  35. ThirdInterFaceId = new Guid("43a9c3a5-8741-4c64-b869-bc304712d88e"),
  36. AppointStartDate = DateTime.Now.Date.AddDays(-10),
  37. MobilePhone = "18911254911"
  38. };
  39. var newEntity = await _appService.GetListByFilterAsync(entity);
  40. foreach (var item in newEntity)
  41. {
  42. _output.WriteLine(item.PersonName);
  43. }
  44. await unitOfWork.CompleteAsync();
  45. }
  46. }
  47. [Fact]
  48. public async Task GetListByFilterAsync2()
  49. {
  50. using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
  51. {
  52. var entity = new AppointPatientRegisterInputDto()
  53. {
  54. ThirdInterFaceId = new Guid("43a9c3a5-8741-4c64-b869-bc304712d88e"),
  55. AppointStartDate = DateTime.Now.Date.AddDays(-10),
  56. MobilePhone = "18911254911"
  57. };
  58. var appServiceHelper = new AppServiceHelper();
  59. var list = await appServiceHelper.CallAppServiceAsync<AppointPatientRegisterInputDto, List<AppointPatientRegisterDto>>
  60. ("api/app/AppointPatientRegister/GetListByFilter", entity);
  61. foreach(var item in list)
  62. {
  63. _output.WriteLine(item.PersonName);
  64. }
  65. //var newEntity = await _appService.GetListByFilterAsync(entity);
  66. //foreach (var item in newEntity)
  67. //{
  68. // _output.WriteLine(item.PersonName);
  69. //}
  70. await unitOfWork.CompleteAsync();
  71. }
  72. }
  73. }
  74. }