Tests/ABPCMS.Tests/Sessions/SessionAppService_Tests.cs
(完整代码) 1KBusing System.Threading.Tasks;
using ABPCMS.Sessions;
using Shouldly;
using Xunit;
namespace ABPCMS.Tests.Sessions
{
public class SessionAppService_Tests : ABPCMSTestBase
{
private readonly ISessionAppService _sessionAppService;
public SessionAppService_Tests()
{
_sessionAppService = Resolve<ISessionAppService>();
}
[MultiTenantFact]
public async Task Should_Get_Current_User_When_Logged_In_As_Host()
{
//Arrange
LoginAsHostAdmin();
//Act
var output = await _sessionAppService.GetCurrentLoginInformations();
//Assert
var currentUser = await GetCurrentUserAsync();
output.User.ShouldNotBe(null);
output.User.Name.ShouldBe(currentUser.Name);
output.User.Surname.ShouldBe(currentUser.Surname);
output.Tenant.ShouldBe(null);
}
[Fact]
public async Task Should_Get_Current_User_And_Tenant_When_Logged_In_As_Tenant()
{
//Act
var output = await _sessionAppService.GetCurrentLoginInformations();
//Assert
var currentUser = await GetCurrentUserAsync();
var currentTenant = await GetCurrentTenantAsync();
output.User.ShouldNotBe(null);
output.User.Name.ShouldBe(currentUser.Name);
output.Tenant.ShouldNotBe(null);
output.Tenant.Name.ShouldBe(currentTenant.Name);
}
}
}
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
