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.
63 lines
2.3 KiB
63 lines
2.3 KiB
using Shentun.Pacs.CustomerOrgGroupDetails;
|
|
using Shentun.Pacs.CustomerOrgGroups;
|
|
using Shentun.Pacs.Models;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Volo.Abp.Application.Services;
|
|
using Volo.Abp.Domain.Repositories;
|
|
using Volo.Abp.Uow;
|
|
using Xunit;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace Shentun.Pacs
|
|
{
|
|
public class CustomerOrgGroupDetailAppServiceTest : PeisApplicationTestBase
|
|
{
|
|
private readonly IRepository<CustomerOrgGroupDetail> _repository;
|
|
private readonly CustomerOrgGroupDetailAppService _appService;
|
|
private readonly ITestOutputHelper _output;
|
|
private readonly IUnitOfWorkManager _unitOfWorkManager;
|
|
public CustomerOrgGroupDetailAppServiceTest(ITestOutputHelper testOutputHelper)
|
|
{
|
|
_output = testOutputHelper;
|
|
_unitOfWorkManager = GetRequiredService<IUnitOfWorkManager>();
|
|
_repository = GetRequiredService<IRepository<CustomerOrgGroupDetail>>();
|
|
_appService = GetRequiredService<CustomerOrgGroupDetailAppService>();
|
|
}
|
|
|
|
[Fact]
|
|
public async Task CreateCustomerOrgGroupDetailManyAsync()
|
|
{
|
|
using (IUnitOfWork unitOfWork = _unitOfWorkManager.Begin())
|
|
{
|
|
var id = new Guid("3a0e6d96-4d37-af35-59cf-eb6f8d27c163");
|
|
var detailList = (await _repository.GetQueryableAsync()).Where(o => o.CustomerOrgGroupId == id).ToList();
|
|
|
|
|
|
CreateCustomerOrgGroupDetailDto dto = new CreateCustomerOrgGroupDetailDto()
|
|
{
|
|
CustomerOrgGroupId = id
|
|
};
|
|
dto.details = new List<CreateCustomerOrgGroupDetail_Detail>();
|
|
foreach (var detail in detailList)
|
|
{
|
|
dto.details.Add(new CreateCustomerOrgGroupDetail_Detail()
|
|
{
|
|
CustomerOrgGroupId = id,
|
|
AsbitemId = detail.AsbitemId,
|
|
Price = detail.Price,
|
|
Amount = detail.Amount
|
|
});
|
|
}
|
|
|
|
|
|
await _appService.CreateCustomerOrgGroupDetailManyAsync(dto);
|
|
await unitOfWork.CompleteAsync();
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|