6 changed files with 113 additions and 3 deletions
-
2src/Shentun.WebPeis.Application.Contracts/AppointPatientRegisters/CreateAppointPatientRegisterDto.cs
-
8src/Shentun.WebPeis.Application/AppointPatientRegisters/AppointPatientRegisterAppService.cs
-
4src/Shentun.WebPeis.Application/WebPeisApplicationAutoMapperProfile.cs
-
22src/Shentun.WebPeis.Domain/AppointPatientRegisters/AppointPatientRegisterManager.cs
-
66test/Shentun.WebPeis.Application.Tests/AppointPatientRegisterAppServiceTest.cs
-
14test/Shentun.WebPeis.EntityFrameworkCore.Tests/EntityFrameworkCore/Applications/EfCoreAppointPatientRegisterAppServiceTest.cs
@ -0,0 +1,66 @@ |
|||||
|
using Shentun.WebPeis.AppointPatientRegisters; |
||||
|
using Shentun.WebPeis.AppointRegisterAsbitems; |
||||
|
using Shentun.WebPeis.Enums; |
||||
|
using Shentun.WebPeis.Models; |
||||
|
using Shentun.WebPeis.Persons; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Domain.Repositories; |
||||
|
using Volo.Abp.Modularity; |
||||
|
using Volo.Abp.Uow; |
||||
|
using Xunit; |
||||
|
using Xunit.Abstractions; |
||||
|
|
||||
|
namespace Shentun.WebPeis |
||||
|
{ |
||||
|
public class AppointPatientRegisterAppServiceTest<TStartupModule> : WebPeisApplicationTestBase<TStartupModule> |
||||
|
where TStartupModule : IAbpModule |
||||
|
{ |
||||
|
private readonly IRepository<AppointPatientRegister> _repository; |
||||
|
private readonly AppointPatientRegisterAppService _appService; |
||||
|
private readonly ITestOutputHelper _output; |
||||
|
private readonly IUnitOfWorkManager _unitOfWorkManager; |
||||
|
public AppointPatientRegisterAppServiceTest(ITestOutputHelper output) |
||||
|
{ |
||||
|
_unitOfWorkManager = GetRequiredService<IUnitOfWorkManager>(); |
||||
|
_repository = GetRequiredService<IRepository<AppointPatientRegister>>(); |
||||
|
_appService = GetRequiredService<AppointPatientRegisterAppService>(); |
||||
|
_output = output; |
||||
|
} |
||||
|
|
||||
|
[Fact] |
||||
|
public async Task CreateAsync() |
||||
|
{ |
||||
|
using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true)) |
||||
|
{ |
||||
|
|
||||
|
var entity = new CreateAppointPatientRegisterDto() |
||||
|
{ |
||||
|
PersonId = new Guid("3a12d7fa-63f1-d549-c2f8-01123e5b7a8a"), |
||||
|
CustomerOrgGroupId = null, |
||||
|
CustomerOrgId = GuidFlag.PersonCustomerOrgId, |
||||
|
MedicalCenterId = new Guid("150da355-dfbf-466b-9697-355836a862c4"), |
||||
|
MedicalPackageId = null, |
||||
|
MedicalStartDate = DateTime.Now, |
||||
|
CustomerOrgRegisterId = GuidFlag.PersonCustomerOrgRegisterId, |
||||
|
PregnantFlag = PregnantFlag.None, |
||||
|
Height = 170, |
||||
|
Weight = 60 |
||||
|
}; |
||||
|
entity.Asbitems.Add( |
||||
|
new CreateAppointRegisterAsbitemDto() |
||||
|
{ |
||||
|
AsbitemId = new Guid("3a126b34-f6f0-56a1-e899-a092874acde7"), |
||||
|
Amount = 1, |
||||
|
ChargePrice = (decimal)30.5 |
||||
|
} |
||||
|
); |
||||
|
var newEntity = await _appService.CreateAsync(entity); |
||||
|
await unitOfWork.CompleteAsync(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Xunit.Abstractions; |
||||
|
|
||||
|
namespace Shentun.WebPeis.EntityFrameworkCore.Applications |
||||
|
{ |
||||
|
public class EfCoreAppointPatientRegisterAppServiceTest : AppointPatientRegisterAppServiceTest<WebPeisEntityFrameworkCoreTestModule> |
||||
|
{ |
||||
|
public EfCoreAppointPatientRegisterAppServiceTest(ITestOutputHelper output) : base(output) { } |
||||
|
} |
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue