using System.Data.Entity; using System.Threading.Tasks; using Abp.Application.Services.Dto; using WePlatform.BaseSystem.Users; using WePlatform.BaseSystem.Users.Dto; using IwbZero.AppServiceBase; using Shouldly; using Xunit; namespace WePlatform.Users { public class UserAppServiceTests : WePlatformTestBase { private readonly IUsersAppService _userAppService; public UserAppServiceTests() { _userAppService = Resolve(); } [Fact] public async Task GetUsers_Test() { //Act var output = await _userAppService.GetAll(new IwbPagedRequestDto { MaxResultCount = 20, SkipCount = 0 }); //Assert output.Items.Count.ShouldBeGreaterThan(0); } [Fact] public async Task CreateUser_Test() { //Act await _userAppService.Create( new UserCreateDto { EmailAddress = "john@volosoft.com", IsActive = true, Name = "John", UserName = "john.nash", RoleNames = "" }); await UsingDbContextAsync(async context => { var johnNashUser = await context.Users.FirstOrDefaultAsync(u => u.UserName == "john.nash"); johnNashUser.ShouldNotBeNull(); }); } } }