49 lines
1.3 KiB
C#
49 lines
1.3 KiB
C#
|
using System.Threading.Tasks;
|
|||
|
using Microsoft.EntityFrameworkCore;
|
|||
|
using Shouldly;
|
|||
|
using Xunit;
|
|||
|
using MineTec.ProManager.Authorization.Users;
|
|||
|
using MineTec.ProManager.Authorization.Users.Dto;
|
|||
|
|
|||
|
namespace MineTec.ProManager.Tests.Users
|
|||
|
{
|
|||
|
public class UserAppService_Tests : ProManagerTestBase
|
|||
|
{
|
|||
|
private readonly IUserAppService _userAppService;
|
|||
|
|
|||
|
public UserAppService_Tests()
|
|||
|
{
|
|||
|
_userAppService = Resolve<IUserAppService>();
|
|||
|
}
|
|||
|
|
|||
|
[Fact]
|
|||
|
public async Task GetUsers_Test()
|
|||
|
{
|
|||
|
// Act
|
|||
|
var output = await _userAppService.GetPagedUser(new GetPagedUserInput { MaxResultCount = 20, SkipCount = 0 });
|
|||
|
|
|||
|
// Assert
|
|||
|
output.Items.Count.ShouldBeGreaterThan(0);
|
|||
|
}
|
|||
|
|
|||
|
[Fact]
|
|||
|
public async Task CreateUser_Test()
|
|||
|
{
|
|||
|
// Act
|
|||
|
await _userAppService.CreateUser(
|
|||
|
new CreateUserDto
|
|||
|
{
|
|||
|
EmailAddress = "john@volosoft.com",
|
|||
|
IsActive = true,
|
|||
|
UserName = "john.nash"
|
|||
|
});
|
|||
|
|
|||
|
await UsingDbContextAsync(async context =>
|
|||
|
{
|
|||
|
var johnNashUser = await context.Users.FirstOrDefaultAsync(u => u.UserName == "john.nash");
|
|||
|
johnNashUser.ShouldNotBeNull();
|
|||
|
});
|
|||
|
}
|
|||
|
}
|
|||
|
}
|