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.

106 lines
2.6 KiB

2 years ago
2 years ago
2 years ago
2 years ago
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 < 500; 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. [Fact]
  44. public async Task TransferPatientRegisterData()
  45. {
  46. for (int i = 0; i < 3000; i++)
  47. {
  48. using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
  49. {
  50. var IsHand = await _appService.TransferPatientRegisterData();
  51. await unitOfWork.CompleteAsync();
  52. _output.WriteLine($"处理{(i + 1) * 1000}");
  53. if (!IsHand)
  54. {
  55. break;
  56. }
  57. }
  58. }
  59. }
  60. [Fact]
  61. public async Task HandPatientRegisterDoctor()
  62. {
  63. for (int i = 0; i < 3000; i++)
  64. {
  65. using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
  66. {
  67. var IsHand = await _appService.HandPatientRegisterDoctor();
  68. await unitOfWork.CompleteAsync();
  69. _output.WriteLine($"处理{(i + 1) * 1000}");
  70. if (!IsHand)
  71. {
  72. break;
  73. }
  74. }
  75. }
  76. }
  77. }
  78. }