commit 578c842eca710c062821c77a1633447d5cdd0336
Author: Tomáš Orlovský <orlovsky@students.zcu.cz>
Date:   Wed Apr 21 22:14:52 2021 +0200

    Implemented first test and added test methods for rest of the tests

diff --git a/tests/Core/Leuze.Tests.Core/Leuze.Tests.Core.csproj b/tests/Core/Leuze.Tests.Core/Leuze.Tests.Core.csproj
index 31d2c87..ee31ca7 100644
--- a/tests/Core/Leuze.Tests.Core/Leuze.Tests.Core.csproj
+++ b/tests/Core/Leuze.Tests.Core/Leuze.Tests.Core.csproj
@@ -1,4 +1,4 @@
-<Project Sdk="Microsoft.NET.Sdk">
+﻿<Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
     <TargetFramework>net5.0</TargetFramework>
@@ -7,6 +7,7 @@
   </PropertyGroup>
 
   <ItemGroup>
+    <PackageReference Include="FluentAssertions" Version="5.10.3" />
     <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
     <PackageReference Include="xunit" Version="2.4.1" />
     <PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
diff --git a/tests/Core/Leuze.Tests.Core/LoginTests.cs b/tests/Core/Leuze.Tests.Core/LoginTests.cs
index 0f18763..214980e 100644
--- a/tests/Core/Leuze.Tests.Core/LoginTests.cs
+++ b/tests/Core/Leuze.Tests.Core/LoginTests.cs
@@ -1,6 +1,15 @@
 using System;
 using System.Threading.Tasks;
+using FluentAssertions;
+using Leuze.Core.Application.CQRS.Auth.Commads;
+using Leuze.Core.Application.Identity;
+using Leuze.Core.Domain.Repositories;
+using Leuze.Core.Infrastructure.Persistence.Repository;
 using Leuze.Tests.Configuration;
+using MediatR;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Identity.UI.V4.Pages.Internal.Account.Manage;
+using Microsoft.Extensions.DependencyInjection;
 using Xunit;
 
 namespace Leuze.Tests.Core
@@ -10,7 +19,14 @@ namespace Leuze.Tests.Core
     {
         public LoginTests()
         {
+            var services = new ServiceCollection();
+            //services.AddTransient<IPermissionRepository, PermissionRepository>();
 
+            Initialize(services);
+
+            ApplicationUser user1 = new ApplicationUser("user1", "user@test.com", false);
+            DatabaseFixture.UserManager.CreateAsync(user1, "kappa123").Wait();
+            //DatabaseFixture.UserManager.AddPasswordAsync(user1, "kappa123").Wait();
         }
 
         [Fact]
@@ -18,9 +34,80 @@ namespace Leuze.Tests.Core
         {
             await _semaphore.WaitAsync();
 
+            IMediator mediator = DatabaseFixture.Services.GetRequiredService<IMediator>();
+            var response = await mediator.Send(new VerifyLocalUser.Command("user@test.com", "kappa123"));
+            response.IsSuccess.Should().BeTrue();
+            //HttpContext context = DatabaseFixture.Services.GetRequiredService<IHttpContextAccessor>().HttpContext;
+            //Assert.True(context.User.Identity.IsAuthenticated);
+            //context.User.Identity.IsAuthenticated.Should().Be(true);
+            
+            _semaphore.Release();
+        }
+
+        [Fact]
+        public async Task ADLoginTest()
+        {
+            //TODO: AD login implementation
+        }
 
+        [Fact]
+        public async Task WrongNameLoginTest()
+        {
+            //TODO: AD login implementation
+        }
 
-            _semaphore.Release();
+        [Fact]
+        public async Task WrongPassLoginTest()
+        {
+            //TODO: AD login implementation
+        }
+
+        [Fact]
+        public async Task AdminRoleTest()
+        {
+            //TODO: AD login implementation
+        }
+
+        [Fact]
+        public async Task NonAdminRoleTest()
+        {
+            //TODO: AD login implementation
+        }
+
+        [Fact]
+        public async Task AdminAddRoleTest()
+        {
+            //TODO: AD login implementation
+        }
+
+        [Fact]
+        public async Task AdminRemoveRoleTest()
+        {
+            //TODO: AD login implementation
+        }
+
+        [Fact]
+        public async Task AdminRemoveAdminRoleTest()
+        {
+            //TODO: AD login implementation
+        }
+
+        [Fact]
+        public async Task AdminRemoveAdminSelfRoleTest()
+        {
+            //TODO: AD login implementation
+        }
+
+        [Fact]
+        public async Task CreateAccTest()
+        {
+            //TODO: AD login implementation
+        }
+
+        [Fact]
+        public async Task CreateADAccTest()
+        {
+            //TODO: AD login implementation
         }
     }
 }
diff --git a/tests/Leuze.Tests.Configuration/DatabaseInMemoryFixture.cs b/tests/Leuze.Tests.Configuration/DatabaseInMemoryFixture.cs
index 13f5083..fb1d5ce 100644
--- a/tests/Leuze.Tests.Configuration/DatabaseInMemoryFixture.cs
+++ b/tests/Leuze.Tests.Configuration/DatabaseInMemoryFixture.cs
@@ -43,6 +43,11 @@ namespace Leuze.Tests.Configuration
         /// </summary>
         public RoleManager<ApplicationRole> RoleManager { get; private set; }
 
+        /// <summary>
+        /// Instance of role manager
+        /// </summary>
+        public SignInManager<ApplicationUser> SignInManager { get; private set; }
+
         /// <summary>
         /// 
         /// </summary>
@@ -60,6 +65,7 @@ namespace Leuze.Tests.Configuration
             // Assign shortcuts accessors to registered components
             UserManager = Services.GetRequiredService<UserManager<ApplicationUser>>();
             RoleManager = Services.GetRequiredService<RoleManager<ApplicationRole>>();
+            SignInManager = Services.GetRequiredService<SignInManager<ApplicationUser>>();
 
             // Storage: create using registered db context / storage context
             Storage = (TestingStorageContext)Services.GetRequiredService<IStorageContext>();
@@ -101,6 +107,8 @@ namespace Leuze.Tests.Configuration
             // Register database-specific storage context implementation.
             services.AddScoped<IStorageContext, TestingStorageContext>();
 
+
+
         }
 
         /// <summary>
