public async Task Should_Get_Current_User_And_Tenant_When_Logged_In_As_Tenant()
        {
            // Act
            WebShop.Sessions.Dto.GetCurrentLoginInformationsOutput output = await _sessionAppService.GetCurrentLoginInformations();

            // Assert
            Authorization.Users.User currentUser = await GetCurrentUserAsync();

            MultiTenancy.Tenant currentTenant = await GetCurrentTenantAsync();

            output.User.ShouldNotBe(null);
            output.User.Name.ShouldBe(currentUser.Name);

            output.Tenant.ShouldNotBe(null);
            output.Tenant.Name.ShouldBe(currentTenant.Name);
        }
        public async Task Should_Get_Current_User_When_Logged_In_As_Host()
        {
            // Arrange
            LoginAsHostAdmin();

            // Act
            WebShop.Sessions.Dto.GetCurrentLoginInformationsOutput output = await _sessionAppService.GetCurrentLoginInformations();

            // Assert
            Authorization.Users.User currentUser = await GetCurrentUserAsync();

            output.User.ShouldNotBe(null);
            output.User.Name.ShouldBe(currentUser.Name);
            output.User.Surname.ShouldBe(currentUser.Surname);

            output.Tenant.ShouldBe(null);
        }
Esempio n. 3
0
        public async Task CreateUser_Test()
        {
            // Act
            await _userAppService.CreateAsync(
                new CreateUserDto
            {
                EmailAddress = "*****@*****.**",
                IsActive     = true,
                Name         = "John",
                Surname      = "Nash",
                Password     = "******",
                UserName     = "******"
            });

            await UsingDbContextAsync(async context =>
            {
                Authorization.Users.User johnNashUser = await context.Users.FirstOrDefaultAsync(u => u.UserName == "john.nash");
                johnNashUser.ShouldNotBeNull();
            });
        }