Sinet.Universal.Admin/test/Sinet.Universal.Admin.Appli.../Samples/SampleAppServiceTests.cs

33 lines
887 B
C#
Raw Normal View History

2023-11-07 23:29:26 +08:00
using Shouldly;
using System.Threading.Tasks;
using Volo.Abp.Identity;
using Xunit;
namespace Sinet.Universal.Admin.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 class SampleAppServiceTests : AdminApplicationTestBase
{
private readonly IIdentityUserAppService _userAppService;
public SampleAppServiceTests()
{
_userAppService = GetRequiredService<IIdentityUserAppService>();
}
[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");
}
}