| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- using Microsoft.EntityFrameworkCore;
- using Shouldly;
- using VberAdmin.BaseSystem.Users;
- using VberZero.AppService.Base.Dto;
- using VberZero.AppService.Users.Dto;
- using Xunit;
- namespace VberAdmin.Tests.Users;
- public class UserAppService_Tests : VberAdminTestBase
- {
- private readonly IUserAppService _userAppService;
- public UserAppService_Tests()
- {
- _userAppService = Resolve<IUserAppService>();
- }
- [Fact]
- public async Task GetUsers_Test()
- {
- // Act
- var output = await _userAppService.GetAll(new VzPagedRequestDto() { MaxResultCount = 20, SkipCount = 0 });
- // Assert
- output.Items.Count.ShouldBeGreaterThan(0);
- }
- [Fact]
- public async Task CreateUser_Test()
- {
- // Act
- await _userAppService.Create(
- new CreateUserDto
- {
- EmailAddress = "john@volosoft.com",
- IsActive = true,
- Name = "John",
- Surname = "Nash",
- Password = "123qwe",
- UserName = "john.nash"
- });
- await UsingDbContextAsync(async context =>
- {
- var johnNashUser = await context.Users.FirstOrDefaultAsync(u => u.UserName == "john.nash");
- johnNashUser.ShouldNotBeNull();
- });
- }
- }
|