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

2 years ago
  1. using NPOI.SS.Formula.Functions;
  2. using Shentun.Peis.CustomerOrgGroups;
  3. using Shentun.Peis.CustomerOrgs;
  4. using Shentun.Peis.Models;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using Volo.Abp.Domain.Repositories;
  11. using Volo.Abp.Uow;
  12. using Xunit;
  13. using Xunit.Abstractions;
  14. namespace Shentun.Peis
  15. {
  16. public class CustomerOrgGroupAppServiceTest : PeisApplicationTestBase
  17. {
  18. private readonly IRepository<CustomerOrgGroup, Guid> _repository;
  19. private readonly CustomerOrgGroupAppService _appService;
  20. private readonly ITestOutputHelper _output;
  21. private readonly IUnitOfWorkManager _unitOfWorkManager;
  22. public CustomerOrgGroupAppServiceTest(ITestOutputHelper testOutputHelper)
  23. {
  24. _output = testOutputHelper;
  25. _unitOfWorkManager = GetRequiredService<IUnitOfWorkManager>();
  26. _repository = GetRequiredService<IRepository<CustomerOrgGroup, Guid>>();
  27. _appService = GetRequiredService<CustomerOrgGroupAppService>();
  28. }
  29. [Fact]
  30. public async Task UpdateAsync()
  31. {
  32. var id = new Guid("3a0e6d96-4d37-af35-59cf-eb6f8d27c163");
  33. var item = await _repository.GetAsync(id);
  34. var updateItem = new UpdateCustomerOrgGroupDto()
  35. {
  36. DisplayName = item.DisplayName,
  37. ForSexId = item.ForSexId,
  38. MaritalStatusId = item.MaritalStatusId,
  39. AgeLowerLimit = item.AgeLowerLimit,
  40. AgeUpperLimit = item.AgeUpperLimit,
  41. Price = 1000,
  42. };
  43. await _appService.UpdateAsync(id, updateItem);
  44. }
  45. [Fact]
  46. public async Task GetListInCustomerOrgIdAsync()
  47. {
  48. using (IUnitOfWork unitOfWork = _unitOfWorkManager.Begin())
  49. {
  50. var items = await _appService.GetListInCustomerOrgIdAsync(new Guid("3a0c5104-62b4-a00a-0e0c-51e558f42515"));
  51. foreach (var item in items)
  52. {
  53. _output.WriteLine(item.DisplayName);
  54. }
  55. await unitOfWork.CompleteAsync();
  56. }
  57. }
  58. }
  59. }