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.

58 lines
1.4 KiB

2 years ago
  1. using Shentun.Peis.CustomerOrgs;
  2. using Shentun.Peis.Models;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using Volo.Abp.Domain.Repositories;
  9. using Volo.Abp.Uow;
  10. using Xunit.Abstractions;
  11. using Xunit;
  12. using Shentun.Peis.DataMigrations;
  13. namespace Shentun.Peis
  14. {
  15. public class BaseDataHandleTest : PeisApplicationTestBase
  16. {
  17. private readonly ITestOutputHelper _output;
  18. private readonly IUnitOfWorkManager _unitOfWorkManager;
  19. private readonly BaseDataHandleAppService _appService;
  20. public BaseDataHandleTest(ITestOutputHelper testOutputHelper)
  21. {
  22. _output = testOutputHelper;
  23. _unitOfWorkManager = GetRequiredService<IUnitOfWorkManager>();
  24. _appService = GetRequiredService<BaseDataHandleAppService>();
  25. }
  26. [Fact]
  27. public async Task TransferPatientData()
  28. {
  29. for (int i = 0; i < 1000; i++)
  30. {
  31. using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
  32. {
  33. var IsHand = await _appService.TransferPatientData();
  34. await unitOfWork.CompleteAsync();
  35. _output.WriteLine($"处理{(i + 1) * 1000}");
  36. if (!IsHand)
  37. {
  38. break;
  39. }
  40. }
  41. }
  42. }
  43. }
  44. }