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.

62 lines
2.2 KiB

using NPOI.SS.Formula.Functions;
using Shentun.Peis.CustomerOrgGroups;
using Shentun.Peis.CustomerOrgs;
using Shentun.Peis.Models;
using System;
using System.Collections.Generic;
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 CustomerOrgGroupAppServiceTest : PeisApplicationTestBase
{
private readonly IRepository<CustomerOrgGroup, Guid> _repository;
private readonly CustomerOrgGroupAppService _appService;
private readonly ITestOutputHelper _output;
private readonly IUnitOfWorkManager _unitOfWorkManager;
public CustomerOrgGroupAppServiceTest(ITestOutputHelper testOutputHelper)
{
_output = testOutputHelper;
_unitOfWorkManager = GetRequiredService<IUnitOfWorkManager>();
_repository = GetRequiredService<IRepository<CustomerOrgGroup, Guid>>();
_appService = GetRequiredService<CustomerOrgGroupAppService>();
}
[Fact]
public async Task UpdateAsync()
{
var id = new Guid("3a0e6d96-4d37-af35-59cf-eb6f8d27c163");
var item = await _repository.GetAsync(id);
var updateItem = new UpdateCustomerOrgGroupDto()
{
DisplayName = item.DisplayName,
ForSexId = item.ForSexId,
MaritalStatusId = item.MaritalStatusId,
AgeLowerLimit = item.AgeLowerLimit,
AgeUpperLimit = item.AgeUpperLimit,
Price = 1000,
};
await _appService.UpdateAsync(id, updateItem);
}
[Fact]
public async Task GetListInCustomerOrgIdAsync()
{
using (IUnitOfWork unitOfWork = _unitOfWorkManager.Begin())
{
var items = await _appService.GetListInCustomerOrgIdAsync(new Guid("3a0c5104-62b4-a00a-0e0c-51e558f42515"));
foreach (var item in items)
{
_output.WriteLine(item.DisplayName);
}
await unitOfWork.CompleteAsync();
}
}
}
}