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.

92 lines
3.2 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. using Shentun.WebPeis.AppointPatientRegisters;
  2. using Shentun.WebPeis.AppointSchedules;
  3. using Shentun.WebPeis.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.Modularity;
  11. using Volo.Abp.Uow;
  12. using Xunit;
  13. using Xunit.Abstractions;
  14. namespace Shentun.WebPeis
  15. {
  16. public class AppointScheduleAppServiceTest<TStartupModule> : WebPeisApplicationTestBase<TStartupModule>
  17. where TStartupModule : IAbpModule
  18. {
  19. private readonly IRepository<AppointSchedule> _repository;
  20. private readonly AppointScheduleAppService _appService;
  21. private readonly ITestOutputHelper _output;
  22. private readonly IUnitOfWorkManager _unitOfWorkManager;
  23. public AppointScheduleAppServiceTest(ITestOutputHelper output)
  24. {
  25. _unitOfWorkManager = GetRequiredService<IUnitOfWorkManager>();
  26. _repository = GetRequiredService<IRepository<AppointSchedule>>();
  27. _appService = GetRequiredService<AppointScheduleAppService>();
  28. _output = output;
  29. }
  30. [Fact]
  31. public async Task GetAppointScheduleDateListAsync()
  32. {
  33. using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
  34. {
  35. var entity = new GetAppointScheduleDateListInputDto()
  36. {
  37. MedicalCenterId = new Guid("150da355-dfbf-466b-9697-355836a862c4")
  38. };
  39. var list = await _appService.GetAppointScheduleDateListAsync(entity);
  40. foreach (var item in list)
  41. {
  42. _output.WriteLine(item.AppointDate.ToString());
  43. }
  44. await unitOfWork.CompleteAsync();
  45. }
  46. }
  47. [Fact]
  48. public async Task GetAppointScheduleTimeListByIdAsync()
  49. {
  50. using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
  51. {
  52. var entity = new AppointScheduleIdInputDto()
  53. {
  54. AppointScheduleId = new Guid("3a12ec2e-a9dc-554c-e90a-7ac4f503819a")
  55. };
  56. var list = await _appService.GetAppointScheduleTimeListByIdAsync(entity);
  57. foreach (var item in list)
  58. {
  59. _output.WriteLine(item.StartTime + "-" + item.StartTime + ":"+ item.CanAppointNumber.ToString());
  60. }
  61. await unitOfWork.CompleteAsync();
  62. }
  63. }
  64. [Fact]
  65. public async Task GetAppointScheduleDateListNoMedicalCenterAsync()
  66. {
  67. using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
  68. {
  69. var entity = new MedicalCenterIdInputDto()
  70. {
  71. // MedicalCenterId = new Guid("150da355-dfbf-466b-9697-355836a862c4")
  72. };
  73. var list = await _appService.GetAppointScheduleDateListAsync(null);
  74. foreach (var item in list)
  75. {
  76. _output.WriteLine(item.AppointDate.ToString());
  77. }
  78. await unitOfWork.CompleteAsync();
  79. }
  80. }
  81. }
  82. }