using System; using Shouldly; using System.Threading.Tasks; using Skcks.Study.AbpProject.Products; using Volo.Abp.Application.Dtos; using Volo.Abp.Identity; using Volo.Abp.Modularity; using Xunit; using Xunit.Abstractions; using Xunit.Sdk; namespace Skcks.Study.AbpProject.Samples; /* This is just an example test class. * Normally, you don't test code of the modules you are using * (like IIdentityUserAppService here). * Only test your own application services. */ public abstract class SampleAppServiceTests : AbpProjectApplicationTestBase where TStartupModule : IAbpModule { private readonly IIdentityUserAppService _userAppService; private readonly IProductAppService _productAppService; private readonly ITestOutputHelper _output; protected SampleAppServiceTests() { _userAppService = GetRequiredService(); _productAppService = GetRequiredService(); } [Fact] public async Task Initial_Data_Should_Contain_Admin_User() { //Act var result = await _userAppService.GetListAsync(new GetIdentityUsersInput()); //Assert result.TotalCount.ShouldBeGreaterThan(0); result.Items.ShouldContain(u => u.UserName == "admin"); } [Fact] public async Task TestProduct() { var result = await _productAppService.GetListAsync(new PagedAndSortedResultRequestDto()); result.TotalCount.ShouldBeGreaterThan(0); // _output.WriteLine(resultDto.ToString()); } }