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
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							75 lines
						
					
					
						
							2.4 KiB
						
					
					
				
								using Shentun.Peis.CustomerOrgs;
							 | 
						|
								using Shentun.Peis.GuideTypes;
							 | 
						|
								using Shentun.Peis.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.Peis
							 | 
						|
								{
							 | 
						|
								    public class CustomerOrgAppServiceTest : PeisApplicationTestBase
							 | 
						|
								    {
							 | 
						|
								        private readonly IRepository<CustomerOrg, Guid> _repository;
							 | 
						|
								        private readonly CustomerOrgAppService _appService;
							 | 
						|
								        private readonly ITestOutputHelper _output;
							 | 
						|
								        private readonly IUnitOfWorkManager _unitOfWorkManager;
							 | 
						|
								        public CustomerOrgAppServiceTest(ITestOutputHelper testOutputHelper)
							 | 
						|
								        {
							 | 
						|
								            _output = testOutputHelper;
							 | 
						|
								            _unitOfWorkManager = GetRequiredService<IUnitOfWorkManager>();
							 | 
						|
								            _repository = GetRequiredService<IRepository<CustomerOrg, Guid>>();
							 | 
						|
								            _appService = GetRequiredService<CustomerOrgAppService>();
							 | 
						|
								        }
							 | 
						|
								
							 | 
						|
								        [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();
							 | 
						|
								            }
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								        }
							 | 
						|
								    }
							 | 
						|
								}
							 |