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.

75 lines
2.4 KiB

11 months ago
11 months ago
  1. using Shentun.Pacs.CustomerOrgs;
  2. using Shentun.Pacs.GuideTypes;
  3. using Shentun.Pacs.Models;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Diagnostics;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using Volo.Abp.Domain.Repositories;
  11. using Volo.Abp.Uow;
  12. using Xunit;
  13. using Xunit.Abstractions;
  14. namespace Shentun.Pacs
  15. {
  16. public class CustomerOrgAppServiceTest : PeisApplicationTestBase
  17. {
  18. private readonly IRepository<CustomerOrg, Guid> _repository;
  19. private readonly CustomerOrgAppService _appService;
  20. private readonly ITestOutputHelper _output;
  21. private readonly IUnitOfWorkManager _unitOfWorkManager;
  22. public CustomerOrgAppServiceTest(ITestOutputHelper testOutputHelper)
  23. {
  24. _output = testOutputHelper;
  25. _unitOfWorkManager = GetRequiredService<IUnitOfWorkManager>();
  26. _repository = GetRequiredService<IRepository<CustomerOrg, Guid>>();
  27. _appService = GetRequiredService<CustomerOrgAppService>();
  28. }
  29. [Fact]
  30. public async Task CreateAsync()
  31. {
  32. var result = await _appService.CreateAsync(new CreateCustomerOrgDto()
  33. {
  34. MedicalCenterId = new Guid("68f2d834-2bf0-4978-ad54-d2133c12a333"),
  35. ParentId = new Guid("3a0c5101-a6a6-e48a-36ec-33e7567a99e6"),
  36. DisplayName = "Foo",
  37. ShortName = "Bar",
  38. OrgTypeId = new Guid("3a0c5100-9a4e-243b-cd63-e0b0391623dd"),
  39. IsActive = 'N',
  40. IsLock = 'N'
  41. }); ;
  42. _output.WriteLine(result.Id.ToString());
  43. }
  44. [Fact]
  45. public async Task GetByCodeAllAsync()
  46. {
  47. using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
  48. {
  49. Stopwatch stopwatch = new Stopwatch();
  50. stopwatch.Start();
  51. var list = await _appService.GetByCodeAllAsync("", 0);
  52. stopwatch.Stop();
  53. TimeSpan elapsed = stopwatch.Elapsed;
  54. _output.WriteLine("代码运行时间:" + elapsed.TotalMilliseconds + "毫秒" + list.Count().ToString());
  55. //foreach (var item in list)
  56. //{
  57. // _output.WriteLine(item.DisplayName);
  58. //}
  59. await unitOfWork.CompleteAsync();
  60. }
  61. }
  62. }
  63. }