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.

68 lines
2.5 KiB

2 years ago
  1. using Shentun.Peis.ChargeRequests;
  2. using Shentun.Peis.ImportLisResults;
  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 ImportLisResultAppServiceTest : PeisApplicationTestBase
  16. {
  17. private readonly IRepository<ImportLisResult> _repository;
  18. private readonly ImportLisResultAppService _appService;
  19. private readonly ITestOutputHelper _output;
  20. private readonly IUnitOfWorkManager _unitOfWorkManager;
  21. public ImportLisResultAppServiceTest(ITestOutputHelper testOutputHelper)
  22. {
  23. _output = testOutputHelper;
  24. _unitOfWorkManager = GetRequiredService<IUnitOfWorkManager>();
  25. _repository = GetRequiredService<IRepository<ImportLisResult>>();
  26. _appService = GetRequiredService<ImportLisResultAppService>();
  27. }
  28. [Fact]
  29. public async Task ImportResultAsync()
  30. {
  31. using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
  32. {
  33. var entity = new List<CreateImportLisResultDto>()
  34. {
  35. new CreateImportLisResultDto()
  36. {
  37. LisRequestNo = "T202404290063",
  38. ItemId = new Guid("3a1203c2-c974-de89-ee07-3427f22fa8f7"),
  39. Result = "32",
  40. Unit = "g/l",
  41. ReferenceRangeValue = "0-20"
  42. },
  43. new CreateImportLisResultDto()
  44. {
  45. LisRequestNo = "T202404290063",
  46. ItemId = new Guid("3a1203c2-ccd1-e29b-84b4-26bd28bbe12e"),
  47. Result = "51.63",
  48. Unit = "ml",
  49. ReferenceRangeValue = "0-20"
  50. },
  51. new CreateImportLisResultDto()
  52. {
  53. LisRequestNo = "T202404290063",
  54. ItemId = new Guid("3a1203c2-d3b1-61fe-94e9-1210fd5555ec"),
  55. Result = "123.001",
  56. Unit = "次",
  57. ReferenceRangeValue = "0-20"
  58. }
  59. };
  60. await _appService.ImportResultAsync(entity);
  61. await unitOfWork.CompleteAsync();
  62. }
  63. }
  64. }
  65. }