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.

66 lines
2.5 KiB

1 year ago
  1. using Shentun.WebPeis.AppointPatientRegisters;
  2. using Shentun.WebPeis.AppointRegisterAsbitems;
  3. using Shentun.WebPeis.Enums;
  4. using Shentun.WebPeis.Models;
  5. using Shentun.WebPeis.Persons;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using Volo.Abp.Domain.Repositories;
  12. using Volo.Abp.Modularity;
  13. using Volo.Abp.Uow;
  14. using Xunit;
  15. using Xunit.Abstractions;
  16. namespace Shentun.WebPeis
  17. {
  18. public class AppointPatientRegisterAppServiceTest<TStartupModule> : WebPeisApplicationTestBase<TStartupModule>
  19. where TStartupModule : IAbpModule
  20. {
  21. private readonly IRepository<AppointPatientRegister> _repository;
  22. private readonly AppointPatientRegisterAppService _appService;
  23. private readonly ITestOutputHelper _output;
  24. private readonly IUnitOfWorkManager _unitOfWorkManager;
  25. public AppointPatientRegisterAppServiceTest(ITestOutputHelper output)
  26. {
  27. _unitOfWorkManager = GetRequiredService<IUnitOfWorkManager>();
  28. _repository = GetRequiredService<IRepository<AppointPatientRegister>>();
  29. _appService = GetRequiredService<AppointPatientRegisterAppService>();
  30. _output = output;
  31. }
  32. [Fact]
  33. public async Task CreateAsync()
  34. {
  35. using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
  36. {
  37. var entity = new CreateAppointPatientRegisterDto()
  38. {
  39. PersonId = new Guid("3a12d7fa-63f1-d549-c2f8-01123e5b7a8a"),
  40. CustomerOrgGroupId = null,
  41. CustomerOrgId = GuidFlag.PersonCustomerOrgId,
  42. MedicalCenterId = new Guid("150da355-dfbf-466b-9697-355836a862c4"),
  43. MedicalPackageId = null,
  44. MedicalStartDate = DateTime.Now,
  45. CustomerOrgRegisterId = GuidFlag.PersonCustomerOrgRegisterId,
  46. PregnantFlag = PregnantFlag.None,
  47. Height = 170,
  48. Weight = 60
  49. };
  50. entity.Asbitems.Add(
  51. new CreateAppointRegisterAsbitemDto()
  52. {
  53. AsbitemId = new Guid("3a126b34-f6f0-56a1-e899-a092874acde7"),
  54. Amount = 1,
  55. ChargePrice = (decimal)30.5
  56. }
  57. );
  58. var newEntity = await _appService.CreateAsync(entity);
  59. await unitOfWork.CompleteAsync();
  60. }
  61. }
  62. }
  63. }