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.

74 lines
2.4 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. using Shentun.WebPeis.Enums;
  2. using Shentun.WebPeis.Models;
  3. using Shentun.WebPeis.Persons;
  4. using Shentun.WebPeis.Wechats;
  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.Modularity;
  12. using Volo.Abp.Uow;
  13. using Xunit;
  14. using Xunit.Abstractions;
  15. namespace Shentun.WebPeis
  16. {
  17. public abstract class PersonAppServiceTest<TStartupModule> : WebPeisApplicationTestBase<TStartupModule>
  18. where TStartupModule : IAbpModule
  19. {
  20. private readonly IRepository<Person> _repository;
  21. private readonly PersonAppService _appService;
  22. private readonly ITestOutputHelper _output;
  23. private readonly IUnitOfWorkManager _unitOfWorkManager;
  24. public PersonAppServiceTest(ITestOutputHelper output)
  25. {
  26. //ITestOutputHelper testOutputHelper
  27. //_output = testOutputHelper;
  28. _unitOfWorkManager = GetRequiredService<IUnitOfWorkManager>();
  29. _repository = GetRequiredService<IRepository<Person>>();
  30. _appService = GetRequiredService<PersonAppService>();
  31. _output = output;
  32. }
  33. [Fact]
  34. public async Task GetWechatUserTokenAsync()
  35. {
  36. using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
  37. {
  38. var entity = new WechatUserJsCodeInputDto()
  39. {
  40. JsCode = "0c1yTa0w3mErQ23eot3w3ocsxw4yTa0P"
  41. };
  42. var newEntity = await _appService.WeChatUserLoginAsync(entity);
  43. await unitOfWork.CompleteAsync();
  44. }
  45. }
  46. [Fact]
  47. public async Task CreateAsync()
  48. {
  49. using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
  50. {
  51. var entity = new CreatePersonDto()
  52. {
  53. JsCode = "0c1yTa0w3mErQ23eot3w3ocsxw4yTa0P",
  54. PersonName = "张三",
  55. MobileTelephone = "18911254911",
  56. MedicalCenterId = new Guid("150da355-dfbf-466b-9697-355836a862c4"),
  57. IdNo = "43062419790909931X",
  58. SexId = SexFlag.Male,
  59. MaritalStatusId = MaritalStatusFlag.Married,
  60. };
  61. var newEntity = await _appService.CreateAsync(entity);
  62. await unitOfWork.CompleteAsync();
  63. }
  64. }
  65. }
  66. }