using System.Threading.Tasks; using Util.Tests.Fakes; using Util.Tests.Services; using Xunit; namespace Util.Applications.Tests { /// /// 客户服务测试 /// public class CustomerServiceTest { /// /// 客户服务 /// private readonly ICustomerService _service; /// /// 测试初始化 /// public CustomerServiceTest( ICustomerService service ) { _service = service; } /// /// 测试创建 /// [Fact] public async Task TestCreateAsync() { //创建 var dto = CustomerFakeService.GetCustomerDto(); var id = await _service.CreateAsync( dto ); //验证 var result = await _service.GetByIdAsync( id ); Assert.NotNull( result ); Assert.Equal( id, result.Id ); Assert.Equal( dto.Code, result.Code ); Assert.Equal( dto.Name, result.Name ); } } }