InterfaceRequestConfigurationRepositoryTests.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using OrBit.MESInterface.Domain.InterfaceConfiguration.Entities;
  2. using OrBit.MESInterface.Domain.InterfaceConfiguration.Repository;
  3. using Shouldly;
  4. using System.Linq;
  5. using System.Threading.Tasks;
  6. using Volo.Abp.Domain.Repositories;
  7. using Xunit;
  8. namespace OrBit.MESInterface.EntityFrameworkCore.Tests.UnitTests
  9. {
  10. public class InterfaceRequestConfigurationRepositoryTests : MESInterfaceEntityFrameworkCoreTestBase
  11. {
  12. private readonly IInterface_Request_ConfigurationRepository _interface_Request_ConfigurationRepository;
  13. private readonly IRepository<Interface_Post_ServiceCode> _interface_Post_ServiceCodeRepository;
  14. private readonly IRepository<Interface_RequestHeader> _interface_RequestHeader;
  15. public InterfaceRequestConfigurationRepositoryTests()
  16. {
  17. _interface_Request_ConfigurationRepository = GetRequiredService<IInterface_Request_ConfigurationRepository>();
  18. _interface_Post_ServiceCodeRepository = GetRequiredService<IRepository<Interface_Post_ServiceCode>>();
  19. _interface_RequestHeader = GetRequiredService<IRepository<Interface_RequestHeader>>();
  20. }
  21. [Fact]
  22. public async Task Should_Get_List_Of_InterfaceRequestConfigurations()
  23. {
  24. var result = await WithUnitOfWorkAsync(async () =>
  25. await _interface_Request_ConfigurationRepository.GetListAsync());
  26. result.Count.ShouldBe(1);
  27. }
  28. [Fact]
  29. public async Task Should_GetList_of_Interface_Post_ServiceCode()
  30. {
  31. var result = await WithUnitOfWorkAsync(async () =>
  32. await _interface_Post_ServiceCodeRepository.GetListAsync()
  33. );
  34. result.Count.ShouldBeGreaterThan(0);
  35. }
  36. [Fact]
  37. public async Task Should_GetList_of_Interface_RequestHeader()
  38. {
  39. var result = await WithUnitOfWorkAsync(async () => await _interface_RequestHeader.GetListAsync());
  40. result.Count.ShouldBeGreaterThan(0);
  41. }
  42. [Fact]
  43. public async Task Should_GetDetailsList_of_InterfaceRequestConfigurations()
  44. {
  45. var result = await WithUnitOfWorkAsync(async () => await _interface_Request_ConfigurationRepository
  46. .GetAsync(config => config.InterfaceType == "SAPDataDownload", true
  47. ));
  48. result.ShouldNotBeNull();
  49. result._Post_ServiceCodes.ToList().Count.ShouldBeGreaterThan(0);
  50. // result[0]._RequestParameters.ToList().Count.ShouldBeGreaterThan(0);
  51. result._RequestHeaders.ToList().Count.ShouldBeGreaterThan(0);
  52. }
  53. }
  54. }