using Shentun.Pacs.CustomerOrgs; using Shentun.Pacs.GuideTypes; using Shentun.Pacs.Models; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; using Volo.Abp.Uow; using Xunit; using Xunit.Abstractions; namespace Shentun.Pacs { public class CustomerOrgAppServiceTest : PeisApplicationTestBase { private readonly IRepository _repository; private readonly CustomerOrgAppService _appService; private readonly ITestOutputHelper _output; private readonly IUnitOfWorkManager _unitOfWorkManager; public CustomerOrgAppServiceTest(ITestOutputHelper testOutputHelper) { _output = testOutputHelper; _unitOfWorkManager = GetRequiredService(); _repository = GetRequiredService>(); _appService = GetRequiredService(); } [Fact] public async Task CreateAsync() { var result = await _appService.CreateAsync(new CreateCustomerOrgDto() { MedicalCenterId = new Guid("68f2d834-2bf0-4978-ad54-d2133c12a333"), ParentId = new Guid("3a0c5101-a6a6-e48a-36ec-33e7567a99e6"), DisplayName = "Foo", ShortName = "Bar", OrgTypeId = new Guid("3a0c5100-9a4e-243b-cd63-e0b0391623dd"), IsActive = 'N', IsLock = 'N' }); ; _output.WriteLine(result.Id.ToString()); } [Fact] public async Task GetByCodeAllAsync() { using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true)) { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); var list = await _appService.GetByCodeAllAsync("", 0); stopwatch.Stop(); TimeSpan elapsed = stopwatch.Elapsed; _output.WriteLine("代码运行时间:" + elapsed.TotalMilliseconds + "毫秒" + list.Count().ToString()); //foreach (var item in list) //{ // _output.WriteLine(item.DisplayName); //} await unitOfWork.CompleteAsync(); } } } }