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.

49 lines
1.6 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. using Shentun.WebPeis.Models;
  2. using Shentun.WebPeis.Persons;
  3. using Shentun.WebPeis.Wechats;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using Volo.Abp.Domain.Repositories;
  10. using Volo.Abp.Modularity;
  11. using Volo.Abp.Uow;
  12. using Xunit;
  13. using Xunit.Abstractions;
  14. namespace Shentun.WebPeis
  15. {
  16. public abstract class PersonAppServiceTest<TStartupModule> : WebPeisApplicationTestBase<TStartupModule>
  17. where TStartupModule : IAbpModule
  18. {
  19. private readonly IRepository<Person> _repository;
  20. private readonly PersonAppService _appService;
  21. //private readonly ITestOutputHelper _output;
  22. private readonly IUnitOfWorkManager _unitOfWorkManager;
  23. public PersonAppServiceTest()
  24. {
  25. //ITestOutputHelper testOutputHelper
  26. //_output = testOutputHelper;
  27. _unitOfWorkManager = GetRequiredService<IUnitOfWorkManager>();
  28. _repository = GetRequiredService<IRepository<Person>>();
  29. _appService = GetRequiredService<PersonAppService>();
  30. //_output = GetRequiredService<ITestOutputHelper>();
  31. }
  32. [Fact]
  33. public async Task GetWechatUserTokenAsync()
  34. {
  35. using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
  36. {
  37. var entity = new WechatUserJsCodeInputDto()
  38. {
  39. JsCode = "0c1yTa0w3mErQ23eot3w3ocsxw4yTa0P"
  40. };
  41. var newEntity = await _appService.GetWechatUserTokenAsync(entity);
  42. await unitOfWork.CompleteAsync();
  43. }
  44. }
  45. }
  46. }