Projekt

Obecné

Profil

« Předchozí | Další » 

Revize d402013e

Přidáno uživatelem Tomáš Orlovský před téměř 4 roky(ů)

Added first tests on goals commands

Zobrazit rozdíly:

Leuze.Tests.Modules.Goal/GoalDefinitionAreasTests.cs
1
//#define TEST
2

  
3
using System;
4
using System.Threading;
5
using System.Threading.Tasks;
6
using FluentAssertions;
7
using Leuze.Core.Application.Authentication;
8
using Leuze.Core.Domain.Repositories;
9
using Leuze.Core.Infrastructure.Persistence.Repository;
10
using Leuze.Core.Infrastructure.Persistence.Seeds;
11
using Leuze.Modules.Goal.Application.CQRS.GoalDefinitionAreas.Commands;
12
using Leuze.Modules.Goal.Domain.Repositories;
13
using Leuze.Modules.Goal.Infrastructure.Persistence.Repositories;
14
using Leuze.Tests.Configuration;
15
using Microsoft.AspNetCore.Components.Authorization;
16
using Microsoft.Extensions.DependencyInjection;
17
using Moq;
18
using Xunit;
19

  
20
namespace Leuze.Tests.Modules.Goal
21
{
22
    [Trait("Category", "Goals")]
23
    public class GoalDefinitionAreasTests : TestWithDatabase
24
    {
25
        public GoalDefinitionAreasTests()
26
        {
27
            var services = new ServiceCollection();
28
            services.AddTransient<IGlobalDefinitionAreaRepository, GlobalDefinitionAreaRepository>();
29
            services.AddTransient<IGoalItemRepository, GoalItemRepository>();
30
            services.AddTransient<IGoalDefinitionRepository, GoalDefinitionRepository>();
31
            services.AddTransient<IDomainUserRepository, DomainUserRepository>();
32
            Initialize(services);
33

  
34
            ApplicationSeed.Run(DatabaseFixture.Storage, DatabaseFixture.UserManager, DatabaseFixture.RoleManager);
35
        }
36

  
37
        [Fact]
38
        public async void CreateNewAreaTestAdmin()
39
        {
40
            await _semaphore.WaitAsync();
41

  
42
            var AuthenticationStateProviderMock = await TestUtils.AuthenticationMock(DatabaseFixture,TestUtils.adminName);
43
            var handler = new CreateNewArea.Handler(
44
                DatabaseFixture.Services.GetRequiredService<IGlobalDefinitionAreaRepository>(),
45
                AuthenticationStateProviderMock.Object,
46
                DatabaseFixture.Services.GetRequiredService<IDomainUserRepository>());
47
            var result = await handler.Handle(new CreateNewArea.Command(DateTime.Today, DateTime.Today.AddDays(1), 0.0), default);
48

  
49
            result.IsSuccess.Should().BeTrue();
50

  
51
            _semaphore.Release();
52
        }
53

  
54
        //TODO: change user
55
        [Fact]
56
        public async void CreateNewAreaTestTL()
57
        {
58
            await _semaphore.WaitAsync();
59

  
60
            var AuthenticationStateProviderMock = await TestUtils.AuthenticationMock(DatabaseFixture, TestUtils.adminName);
61
            var handler = new CreateNewArea.Handler(
62
                DatabaseFixture.Services.GetRequiredService<IGlobalDefinitionAreaRepository>(),
63
                AuthenticationStateProviderMock.Object,
64
                DatabaseFixture.Services.GetRequiredService<IDomainUserRepository>());
65
            var result = await handler.Handle(new CreateNewArea.Command(DateTime.Today, DateTime.Today.AddDays(1), 0.0), default);
66

  
67
            result.IsSuccess.Should().BeTrue();
68

  
69
            _semaphore.Release();
70
        }
71

  
72
        //TODO: change user
73
        [Fact]
74
        public async void CreateNewAreaTestMA()
75
        {
76
            await _semaphore.WaitAsync();
77

  
78
            var AuthenticationStateProviderMock = await TestUtils.AuthenticationMock(DatabaseFixture, TestUtils.adminName);
79
            var handler = new CreateNewArea.Handler(
80
                DatabaseFixture.Services.GetRequiredService<IGlobalDefinitionAreaRepository>(),
81
                AuthenticationStateProviderMock.Object,
82
                DatabaseFixture.Services.GetRequiredService<IDomainUserRepository>());
83
            var result = await handler.Handle(new CreateNewArea.Command(DateTime.Today, DateTime.Today.AddDays(1), 0.0), default);
84

  
85
            result.IsSuccess.Should().BeTrue();
86

  
87
            _semaphore.Release();
88
        }
89

  
90
        //private async Task<Mock<AuthenticatedUserProvider>> AuthenticationMock(string username)
91
        //{
92
        //    var user = await DatabaseFixture.UserManager.FindByEmailAsync(username);
93
        //    (user != null).Should().BeTrue();
94

  
95
        //    var AuthenticationStateProviderMock = new Mock<AuthenticatedUserProvider>(Mock.Of<AuthenticationStateProvider>());
96
        //    AuthenticationStateProviderMock.Setup(e => e.RequiredUserId).Returns(user.Id);
97
        //    return AuthenticationStateProviderMock;
98
        //}
99
    }
100
}
Leuze.Tests.Modules.Goal/GoalDefinitionsTests.cs
1
using System;
2
using System.Collections.Generic;
3
using System.Text;
4

  
5
namespace Leuze.Tests.Modules.Goal
6
{
7
    class GoalDefinitionsTests
8
    {
9
    }
10
}
Leuze.Tests.Modules.Goal/GoalsTests.cs
1
using System;
2
using System.Collections.Generic;
3
using System.Text;
4

  
5
namespace Leuze.Tests.Modules.Goal
6
{
7
    class GoalsTests
8
    {
9
    }
10
}
Leuze.Tests.Modules.Goal/Leuze.Tests.Modules.Goal.csproj
1
<Project Sdk="Microsoft.NET.Sdk">
2

  
3
  <PropertyGroup>
4
    <TargetFramework>net5.0</TargetFramework>
5

  
6
    <IsPackable>false</IsPackable>
7
    <DefineConstants>TEST</DefineConstants>
8
    <Configurations>Debug;Release;Test</Configurations>
9
  </PropertyGroup>
10

  
11
  <ItemGroup>
12
    <PackageReference Include="FluentAssertions" Version="5.10.3" />
13
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
14
    <PackageReference Include="Moq" Version="4.16.1" />
15
    <PackageReference Include="xunit" Version="2.4.1" />
16
    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
17
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
18
      <PrivateAssets>all</PrivateAssets>
19
    </PackageReference>
20
    <PackageReference Include="coverlet.collector" Version="3.0.3">
21
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
22
      <PrivateAssets>all</PrivateAssets>
23
    </PackageReference>
24
  </ItemGroup>
25

  
26
  <ItemGroup>
27
    <ProjectReference Include="..\src\Modules\Goal\Application\Leuze.Modules.Goal.Application\Leuze.Modules.Goal.Application.csproj" />
28
    <ProjectReference Include="..\src\Modules\Goal\Infrastructure\Leuze.Modules.Goal.Infrastructure.Persistence\Leuze.Modules.Goal.Infrastructure.Persistence.csproj" />
29
    <ProjectReference Include="..\tests\Leuze.Tests.Configuration\Leuze.Tests.Configuration.csproj" />
30
  </ItemGroup>
31

  
32
</Project>
Leuze.Tests.Modules.Goal/TestUtils.cs
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
using System.Threading.Tasks;
6
using FluentAssertions;
7
using Leuze.Core.Application.Authentication;
8
using Leuze.Tests.Configuration;
9
using Microsoft.AspNetCore.Components.Authorization;
10
using Moq;
11

  
12
namespace Leuze.Tests.Modules.Goal
13
{
14
    public static class TestUtils
15
    {
16
        public const string adminName = "admin@test.cz";
17
        public const string TLName = "silent@test.cz";
18
        public const string MAName = "orlicek@test.cz";
19

  
20
        public static async Task<Mock<AuthenticatedUserProvider>> AuthenticationMock(DatabaseInMemoryFixture DatabaseFixture, string username)
21
        {
22
            var user = await DatabaseFixture.UserManager.FindByEmailAsync(username);
23
            (user != null).Should().BeTrue();
24

  
25
            var AuthenticationStateProviderMock = new Mock<AuthenticatedUserProvider>(Mock.Of<AuthenticationStateProvider>());
26
            AuthenticationStateProviderMock.Setup(e => e.RequiredUserId).Returns(user.Id);
27
            return AuthenticationStateProviderMock;
28
        }
29
    }
30
}
Leuze.sln
53 53
EndProject
54 54
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Leuze.Modules.Goal.Infrastructure.Persistence", "src\Modules\Goal\Infrastructure\Leuze.Modules.Goal.Infrastructure.Persistence\Leuze.Modules.Goal.Infrastructure.Persistence.csproj", "{BEBFBA58-BCB7-4F44-9247-EAAAE748176A}"
55 55
EndProject
56
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Goals", "Goals", "{B89031F6-163B-417B-B90E-2DC90A30E7A1}"
57
EndProject
58
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Leuze.Tests.Modules.Goal", "Leuze.Tests.Modules.Goal\Leuze.Tests.Modules.Goal.csproj", "{2824A507-5BBD-44B7-9F3A-643F29C7E597}"
59
EndProject
56 60
Global
57 61
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
58 62
		Debug|Any CPU = Debug|Any CPU
59 63
		Release|Any CPU = Release|Any CPU
64
		Test|Any CPU = Test|Any CPU
60 65
	EndGlobalSection
61 66
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
62 67
		{B316B6E4-2898-4F23-9D96-97A90F41BFDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
63 68
		{B316B6E4-2898-4F23-9D96-97A90F41BFDC}.Debug|Any CPU.Build.0 = Debug|Any CPU
64 69
		{B316B6E4-2898-4F23-9D96-97A90F41BFDC}.Release|Any CPU.ActiveCfg = Release|Any CPU
65 70
		{B316B6E4-2898-4F23-9D96-97A90F41BFDC}.Release|Any CPU.Build.0 = Release|Any CPU
71
		{B316B6E4-2898-4F23-9D96-97A90F41BFDC}.Test|Any CPU.ActiveCfg = Test|Any CPU
72
		{B316B6E4-2898-4F23-9D96-97A90F41BFDC}.Test|Any CPU.Build.0 = Test|Any CPU
66 73
		{66EEF1C2-9476-4FF6-86F7-2C1035C7DC66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
67 74
		{66EEF1C2-9476-4FF6-86F7-2C1035C7DC66}.Debug|Any CPU.Build.0 = Debug|Any CPU
68 75
		{66EEF1C2-9476-4FF6-86F7-2C1035C7DC66}.Release|Any CPU.ActiveCfg = Release|Any CPU
69 76
		{66EEF1C2-9476-4FF6-86F7-2C1035C7DC66}.Release|Any CPU.Build.0 = Release|Any CPU
77
		{66EEF1C2-9476-4FF6-86F7-2C1035C7DC66}.Test|Any CPU.ActiveCfg = Debug|Any CPU
78
		{66EEF1C2-9476-4FF6-86F7-2C1035C7DC66}.Test|Any CPU.Build.0 = Debug|Any CPU
70 79
		{D4908C8E-6488-457B-B045-4D769D9ACA76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
71 80
		{D4908C8E-6488-457B-B045-4D769D9ACA76}.Debug|Any CPU.Build.0 = Debug|Any CPU
72 81
		{D4908C8E-6488-457B-B045-4D769D9ACA76}.Release|Any CPU.ActiveCfg = Release|Any CPU
73 82
		{D4908C8E-6488-457B-B045-4D769D9ACA76}.Release|Any CPU.Build.0 = Release|Any CPU
83
		{D4908C8E-6488-457B-B045-4D769D9ACA76}.Test|Any CPU.ActiveCfg = Test|Any CPU
84
		{D4908C8E-6488-457B-B045-4D769D9ACA76}.Test|Any CPU.Build.0 = Test|Any CPU
74 85
		{B443BE7B-7A75-4BAE-872B-85C13D528C3C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
75 86
		{B443BE7B-7A75-4BAE-872B-85C13D528C3C}.Debug|Any CPU.Build.0 = Debug|Any CPU
76 87
		{B443BE7B-7A75-4BAE-872B-85C13D528C3C}.Release|Any CPU.ActiveCfg = Release|Any CPU
77 88
		{B443BE7B-7A75-4BAE-872B-85C13D528C3C}.Release|Any CPU.Build.0 = Release|Any CPU
89
		{B443BE7B-7A75-4BAE-872B-85C13D528C3C}.Test|Any CPU.ActiveCfg = Test|Any CPU
90
		{B443BE7B-7A75-4BAE-872B-85C13D528C3C}.Test|Any CPU.Build.0 = Test|Any CPU
78 91
		{3926F2A1-547E-48E4-B87F-29C21E7FC625}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
79 92
		{3926F2A1-547E-48E4-B87F-29C21E7FC625}.Debug|Any CPU.Build.0 = Debug|Any CPU
80 93
		{3926F2A1-547E-48E4-B87F-29C21E7FC625}.Release|Any CPU.ActiveCfg = Release|Any CPU
81 94
		{3926F2A1-547E-48E4-B87F-29C21E7FC625}.Release|Any CPU.Build.0 = Release|Any CPU
95
		{3926F2A1-547E-48E4-B87F-29C21E7FC625}.Test|Any CPU.ActiveCfg = Test|Any CPU
96
		{3926F2A1-547E-48E4-B87F-29C21E7FC625}.Test|Any CPU.Build.0 = Test|Any CPU
82 97
		{674168B3-2D4C-4746-A1A7-FE890BD59C1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
83 98
		{674168B3-2D4C-4746-A1A7-FE890BD59C1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
84 99
		{674168B3-2D4C-4746-A1A7-FE890BD59C1A}.Release|Any CPU.ActiveCfg = Release|Any CPU
85 100
		{674168B3-2D4C-4746-A1A7-FE890BD59C1A}.Release|Any CPU.Build.0 = Release|Any CPU
101
		{674168B3-2D4C-4746-A1A7-FE890BD59C1A}.Test|Any CPU.ActiveCfg = Debug|Any CPU
102
		{674168B3-2D4C-4746-A1A7-FE890BD59C1A}.Test|Any CPU.Build.0 = Debug|Any CPU
86 103
		{D037B7D3-CA28-4EBD-9E2F-3F3D347950CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
87 104
		{D037B7D3-CA28-4EBD-9E2F-3F3D347950CF}.Debug|Any CPU.Build.0 = Debug|Any CPU
88 105
		{D037B7D3-CA28-4EBD-9E2F-3F3D347950CF}.Release|Any CPU.ActiveCfg = Release|Any CPU
89 106
		{D037B7D3-CA28-4EBD-9E2F-3F3D347950CF}.Release|Any CPU.Build.0 = Release|Any CPU
107
		{D037B7D3-CA28-4EBD-9E2F-3F3D347950CF}.Test|Any CPU.ActiveCfg = Test|Any CPU
108
		{D037B7D3-CA28-4EBD-9E2F-3F3D347950CF}.Test|Any CPU.Build.0 = Test|Any CPU
90 109
		{8ECAEA01-61F3-402D-B94E-E54FC0C94C8E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
91 110
		{8ECAEA01-61F3-402D-B94E-E54FC0C94C8E}.Debug|Any CPU.Build.0 = Debug|Any CPU
92 111
		{8ECAEA01-61F3-402D-B94E-E54FC0C94C8E}.Release|Any CPU.ActiveCfg = Release|Any CPU
93 112
		{8ECAEA01-61F3-402D-B94E-E54FC0C94C8E}.Release|Any CPU.Build.0 = Release|Any CPU
113
		{8ECAEA01-61F3-402D-B94E-E54FC0C94C8E}.Test|Any CPU.ActiveCfg = Test|Any CPU
114
		{8ECAEA01-61F3-402D-B94E-E54FC0C94C8E}.Test|Any CPU.Build.0 = Test|Any CPU
94 115
		{D271989D-921D-486B-929C-6BBF1EC0EED4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
95 116
		{D271989D-921D-486B-929C-6BBF1EC0EED4}.Debug|Any CPU.Build.0 = Debug|Any CPU
96 117
		{D271989D-921D-486B-929C-6BBF1EC0EED4}.Release|Any CPU.ActiveCfg = Release|Any CPU
97 118
		{D271989D-921D-486B-929C-6BBF1EC0EED4}.Release|Any CPU.Build.0 = Release|Any CPU
119
		{D271989D-921D-486B-929C-6BBF1EC0EED4}.Test|Any CPU.ActiveCfg = Test|Any CPU
120
		{D271989D-921D-486B-929C-6BBF1EC0EED4}.Test|Any CPU.Build.0 = Test|Any CPU
98 121
		{C49CA0F7-C0C2-4FCE-98C4-4E42765B4405}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
99 122
		{C49CA0F7-C0C2-4FCE-98C4-4E42765B4405}.Debug|Any CPU.Build.0 = Debug|Any CPU
100 123
		{C49CA0F7-C0C2-4FCE-98C4-4E42765B4405}.Release|Any CPU.ActiveCfg = Release|Any CPU
101 124
		{C49CA0F7-C0C2-4FCE-98C4-4E42765B4405}.Release|Any CPU.Build.0 = Release|Any CPU
125
		{C49CA0F7-C0C2-4FCE-98C4-4E42765B4405}.Test|Any CPU.ActiveCfg = Test|Any CPU
126
		{C49CA0F7-C0C2-4FCE-98C4-4E42765B4405}.Test|Any CPU.Build.0 = Test|Any CPU
102 127
		{C6F9EFF2-30DA-4FA9-AEFF-4957F0260267}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
103 128
		{C6F9EFF2-30DA-4FA9-AEFF-4957F0260267}.Debug|Any CPU.Build.0 = Debug|Any CPU
104 129
		{C6F9EFF2-30DA-4FA9-AEFF-4957F0260267}.Release|Any CPU.ActiveCfg = Release|Any CPU
105 130
		{C6F9EFF2-30DA-4FA9-AEFF-4957F0260267}.Release|Any CPU.Build.0 = Release|Any CPU
131
		{C6F9EFF2-30DA-4FA9-AEFF-4957F0260267}.Test|Any CPU.ActiveCfg = Test|Any CPU
132
		{C6F9EFF2-30DA-4FA9-AEFF-4957F0260267}.Test|Any CPU.Build.0 = Test|Any CPU
106 133
		{BAAC1AB6-C671-408C-94EF-96459D5403DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
107 134
		{BAAC1AB6-C671-408C-94EF-96459D5403DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
108 135
		{BAAC1AB6-C671-408C-94EF-96459D5403DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
109 136
		{BAAC1AB6-C671-408C-94EF-96459D5403DD}.Release|Any CPU.Build.0 = Release|Any CPU
137
		{BAAC1AB6-C671-408C-94EF-96459D5403DD}.Test|Any CPU.ActiveCfg = Test|Any CPU
138
		{BAAC1AB6-C671-408C-94EF-96459D5403DD}.Test|Any CPU.Build.0 = Test|Any CPU
110 139
		{BEBFBA58-BCB7-4F44-9247-EAAAE748176A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
111 140
		{BEBFBA58-BCB7-4F44-9247-EAAAE748176A}.Debug|Any CPU.Build.0 = Debug|Any CPU
112 141
		{BEBFBA58-BCB7-4F44-9247-EAAAE748176A}.Release|Any CPU.ActiveCfg = Release|Any CPU
113 142
		{BEBFBA58-BCB7-4F44-9247-EAAAE748176A}.Release|Any CPU.Build.0 = Release|Any CPU
143
		{BEBFBA58-BCB7-4F44-9247-EAAAE748176A}.Test|Any CPU.ActiveCfg = Test|Any CPU
144
		{BEBFBA58-BCB7-4F44-9247-EAAAE748176A}.Test|Any CPU.Build.0 = Test|Any CPU
145
		{2824A507-5BBD-44B7-9F3A-643F29C7E597}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
146
		{2824A507-5BBD-44B7-9F3A-643F29C7E597}.Debug|Any CPU.Build.0 = Debug|Any CPU
147
		{2824A507-5BBD-44B7-9F3A-643F29C7E597}.Release|Any CPU.ActiveCfg = Release|Any CPU
148
		{2824A507-5BBD-44B7-9F3A-643F29C7E597}.Release|Any CPU.Build.0 = Release|Any CPU
149
		{2824A507-5BBD-44B7-9F3A-643F29C7E597}.Test|Any CPU.ActiveCfg = Test|Any CPU
150
		{2824A507-5BBD-44B7-9F3A-643F29C7E597}.Test|Any CPU.Build.0 = Test|Any CPU
114 151
	EndGlobalSection
115 152
	GlobalSection(SolutionProperties) = preSolution
116 153
		HideSolutionNode = FALSE
......
137 174
		{C6F9EFF2-30DA-4FA9-AEFF-4957F0260267} = {1AEE9C09-804F-4AF7-B966-80830B39C85F}
138 175
		{BAAC1AB6-C671-408C-94EF-96459D5403DD} = {4A441C7D-2659-4FB5-8886-420728C229BF}
139 176
		{BEBFBA58-BCB7-4F44-9247-EAAAE748176A} = {E4134FEF-ECBC-4EEF-A65B-8E8D318DA8DA}
177
		{B89031F6-163B-417B-B90E-2DC90A30E7A1} = {C5588326-929D-42B3-912B-9D838373B48E}
178
		{2824A507-5BBD-44B7-9F3A-643F29C7E597} = {B89031F6-163B-417B-B90E-2DC90A30E7A1}
140 179
	EndGlobalSection
141 180
	GlobalSection(ExtensibilityGlobals) = postSolution
142 181
		SolutionGuid = {849C3668-1CB9-4F98-ADFA-A71F5629384C}
src/Core/Application/Leuze.Core.Application.Identity/Leuze.Core.Application.Identity.csproj
5 5
    <RootNamespace>Leuze.Core.Application.Identity</RootNamespace>
6 6
    <Product></Product>
7 7
    <Description></Description>
8
    <Configurations>Debug;Release;Test</Configurations>
8 9
  </PropertyGroup>
9 10

  
10 11
  <PropertyGroup>
......
18 19
    <DocumentationFile>..\..\..\..\docs\Leuze.Core.Application.Identity.xml</DocumentationFile>
19 20
  </PropertyGroup>
20 21

  
22
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Test|AnyCPU'">
23
    <OutputPath>..\..\..\Presentation\Leuze.Modules\</OutputPath>
24
    <DocumentationFile>..\..\..\..\docs\Leuze.Core.Application.Identity.xml</DocumentationFile>
25
  </PropertyGroup>
26

  
21 27
  <ItemGroup>
22 28
    <PackageReference Include="ExtCore.Data.Entities.Abstractions" Version="6.0.0" />
23 29
    <PackageReference Include="Microsoft.Extensions.Identity.Core" Version="5.0.4" />
src/Core/Application/Leuze.Core.Application.UI/Leuze.Core.Application.UI.csproj
5 5
    <RootNamespace>Leuze.Core.Application.UI</RootNamespace>
6 6
    <Product></Product>
7 7
    <Description></Description>
8
    <Configurations>Debug;Release;Test</Configurations>
8 9
  </PropertyGroup>
9 10

  
10 11
  <PropertyGroup>
......
21 22
    <DocumentationFile>..\..\..\..\docs\Leuze.Core.Application.xml</DocumentationFile>
22 23
  </PropertyGroup>
23 24

  
25
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Test|AnyCPU'">
26
    <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
27
    <OutputPath>..\..\..\Presentation\Leuze.Modules\</OutputPath>
28
    <DocumentationFile>..\..\..\..\docs\Leuze.Core.Application.xml</DocumentationFile>
29
  </PropertyGroup>
30

  
24 31
  <ItemGroup>
25 32
    <PackageReference Include="Blazored.Toast" Version="3.1.2" />
26 33
    <PackageReference Include="Blazored.Typeahead" Version="4.6.0" />
src/Core/Application/Leuze.Core.Application/Authentication/AuthenticatedUserProvider.cs
26 26
            private set { }
27 27
        }
28 28

  
29
        public Guid RequiredUserId
29
        public virtual Guid RequiredUserId
30 30
        {
31 31
            get
32 32
            {
src/Core/Application/Leuze.Core.Application/Leuze.Core.Application.csproj
5 5
    <RootNamespace>Leuze.Core.Application</RootNamespace>
6 6
    <Product></Product>
7 7
    <Description></Description>
8
    <Configurations>Debug;Release;Test</Configurations>
8 9
  </PropertyGroup>
9 10

  
10 11
  <PropertyGroup>
......
18 19
    <DocumentationFile>..\..\..\..\docs\Leuze.Core.Application.xml</DocumentationFile>
19 20
  </PropertyGroup>
20 21

  
22
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Test|AnyCPU'">
23
    <OutputPath>..\..\..\Presentation\Leuze.Modules\</OutputPath>
24
    <DocumentationFile>..\..\..\..\docs\Leuze.Core.Application.xml</DocumentationFile>
25
  </PropertyGroup>
26

  
21 27
  <ItemGroup>
22 28
    <PackageReference Include="AutoMapper" Version="10.1.1" />
23 29
    <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.1" />
src/Core/Domain/Leuze.Core.Domain/Leuze.Core.Domain.csproj
5 5
    <RootNamespace>Leuze.Core.Domain</RootNamespace>
6 6
    <Product></Product>
7 7
    <Description></Description>
8
    <Configurations>Debug;Release;Test</Configurations>
8 9
  </PropertyGroup>
9 10

  
10 11
  <PropertyGroup>
......
18 19
    <DocumentationFile>..\..\..\..\docs\Leuze.Core.Domain.xml</DocumentationFile>
19 20
  </PropertyGroup>
20 21

  
22
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Test|AnyCPU'">
23
    <OutputPath>..\..\..\Presentation\Leuze.Modules\</OutputPath>
24
    <DocumentationFile>..\..\..\..\docs\Leuze.Core.Domain.xml</DocumentationFile>
25
  </PropertyGroup>
26

  
21 27
  <ItemGroup>
22 28
    <PackageReference Include="ExtCore.Data.Abstractions" Version="6.0.0" />
23 29
    <PackageReference Include="ExtCore.Data.Entities.Abstractions" Version="6.0.0" />
src/Core/Infrastructure/Leuze.Core.Infrastructure.Persistence/Leuze.Core.Infrastructure.Persistence.csproj
5 5
    <RootNamespace>Leuze.Core.Infrastructure.Persistence</RootNamespace>
6 6
    <Product></Product>
7 7
    <Description></Description>
8
    <Configurations>Debug;Release;Test</Configurations>
8 9
  </PropertyGroup>
9 10

  
10 11
  <PropertyGroup>
......
18 19
    <DocumentationFile>..\..\..\..\docs\Leuze.Core.Infrastructure.Persistence.xml</DocumentationFile>
19 20
  </PropertyGroup>
20 21

  
22
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Test|AnyCPU'">
23
    <OutputPath>..\..\..\Presentation\Leuze.Modules\</OutputPath>
24
    <DocumentationFile>..\..\..\..\docs\Leuze.Core.Infrastructure.Persistence.xml</DocumentationFile>
25
  </PropertyGroup>
26

  
21 27
  <ItemGroup>
22 28
    <PackageReference Include="EntityFramework" Version="6.4.4" />
23 29
    <PackageReference Include="ExtCore.Data.EntityFramework" Version="6.0.0" />
src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/Leuze.Modules.Goal.Application.UI.csproj
5 5
    <RootNamespace>Leuze.Modules.Goal.Application.UI</RootNamespace>
6 6
    <Product></Product>
7 7
    <Description></Description>
8
    <Configurations>Debug;Release;Test</Configurations>
8 9
  </PropertyGroup>
9 10

  
10 11
  <PropertyGroup>
......
19 20
    <DocumentationFile>..\..\..\..\..\docs\Leuze.Modules.Goal.Application.UI.xml</DocumentationFile>
20 21
  </PropertyGroup>
21 22

  
23
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Test|AnyCPU'">
24
    <OutputPath>..\..\..\..\Presentation\Leuze.Modules\</OutputPath>
25
    <DocumentationFile>..\..\..\..\..\docs\Leuze.Modules.Goal.Application.UI.xml</DocumentationFile>
26
  </PropertyGroup>
27

  
22 28
  <ItemGroup>
23 29
    <ProjectReference Include="..\..\..\..\Core\Application\Leuze.Core.Application.UI\Leuze.Core.Application.UI.csproj" />
24 30
    <ProjectReference Include="..\Leuze.Modules.Goal.Application\Leuze.Modules.Goal.Application.csproj" />
src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/GoalDefinitionAreas/Commands/CreateNewArea.cs
10 10
using System.Text;
11 11
using System.Threading;
12 12
using System.Threading.Tasks;
13
using Leuze.Core.Application.Authentication;
13 14

  
14 15
namespace Leuze.Modules.Goal.Application.CQRS.GoalDefinitionAreas.Commands
15 16
{
......
23 24
        public class Handler : IBaseRequestHandler<Command, Response>
24 25
        {
25 26
            private readonly IGlobalDefinitionAreaRepository _gdAreaRepo;
26
            private readonly AuthenticationStateProvider _authenticationStateProvider;
27
            private readonly AuthenticatedUserProvider _authenticationStateProvider;
27 28
            private readonly IDomainUserRepository _domainUserRepo;
28 29

  
29
            public Handler(IGlobalDefinitionAreaRepository gdAreaRepo, AuthenticationStateProvider authStateProvider, IDomainUserRepository domainUserRepo)
30
            public Handler(IGlobalDefinitionAreaRepository gdAreaRepo, AuthenticatedUserProvider authStateProvider, IDomainUserRepository domainUserRepo)
30 31
            {
31 32
                _gdAreaRepo = gdAreaRepo;
32 33
                _authenticationStateProvider = authStateProvider;
......
40 41
                    return RequestResponse<Response>.CreateErrorResponse($"Zadán nevalidní rozsah!");
41 42
                }
42 43

  
43
                var state = await _authenticationStateProvider.GetAuthenticationStateAsync();
44
                var id = Guid.Parse(state.User!.FindFirst(ClaimTypes.NameIdentifier)!.Value);
44
                var id = _authenticationStateProvider.RequiredUserId;
45 45
                var user = await _domainUserRepo.GetByIdAsync(id);
46 46
                var alreadyExistingAreas = await _gdAreaRepo.GetAllWithinTimeRange(request.from, request.to);
47 47

  
src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/GoalDefinitions/Queries/GetAllForArea.cs
10 10
using System.Text;
11 11
using System.Threading;
12 12
using System.Threading.Tasks;
13
using Leuze.Core.Application.Authentication;
13 14

  
14 15
namespace Leuze.Modules.Goal.Application.CQRS.GoalDefinitions.Queries
15 16
{
......
23 24
        public class Handler : IBaseRequestHandler<Query, Response>
24 25
        {
25 26
            private readonly IGoalDefinitionRepository _goalDefinitionRepo;
26
            private readonly AuthenticationStateProvider _authenticationStateProvider;
27
            private readonly AuthenticatedUserProvider _authenticationStateProvider;
27 28
            private readonly IDomainUserRepository _domainUserRepo;
28 29

  
29
            public Handler(IDomainUserRepository domainUserRepo, AuthenticationStateProvider authStateProvider, IGoalDefinitionRepository goalDefinitionRepo)
30
            public Handler(IDomainUserRepository domainUserRepo, AuthenticatedUserProvider authStateProvider, IGoalDefinitionRepository goalDefinitionRepo)
30 31
            {
31 32
                _goalDefinitionRepo = goalDefinitionRepo;
32 33
                _domainUserRepo = domainUserRepo;
......
35 36

  
36 37
            public async Task<RequestResponse<Response>> Handle(Query request, CancellationToken cancellationToken)
37 38
            {
38
                var state = await _authenticationStateProvider.GetAuthenticationStateAsync();
39
                var id = Guid.Parse(state.User!.FindFirst(ClaimTypes.NameIdentifier)!.Value);
39
                var id = _authenticationStateProvider.RequiredUserId;
40 40
                var userShortDto = await _domainUserRepo.GetDtoByIdAsync(id);
41 41

  
42 42
                if(userShortDto == null)
src/Modules/Goal/Application/Leuze.Modules.Goal.Application/Leuze.Modules.Goal.Application.csproj
5 5
    <RootNamespace>Leuze.Modules.Goal.Application</RootNamespace>
6 6
    <Product></Product>
7 7
    <Description></Description>
8
    <Configurations>Debug;Release;Test</Configurations>
8 9
  </PropertyGroup>
9 10

  
10 11
  <PropertyGroup>
......
18 19
    <DocumentationFile>..\..\..\..\..\docs\Leuze.Modules.Goal.Application.xml</DocumentationFile>
19 20
  </PropertyGroup>
20 21

  
22
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Test|AnyCPU'">
23
    <OutputPath>..\..\..\..\Presentation\Leuze.Modules\</OutputPath>
24
    <DocumentationFile>..\..\..\..\..\docs\Leuze.Modules.Goal.Application.xml</DocumentationFile>
25
  </PropertyGroup>
26

  
21 27
  <ItemGroup>
22 28
    <ProjectReference Include="..\..\..\..\Core\Application\Leuze.Core.Application\Leuze.Core.Application.csproj" />
23 29
    <ProjectReference Include="..\..\Domain\Leuze.Modules.Goal.Domain\Leuze.Modules.Goal.Domain.csproj" />
src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Leuze.Modules.Goal.Domain.csproj
5 5
    <RootNamespace>Leuze.Modules.Goal.Domain</RootNamespace>
6 6
    <Product></Product>
7 7
    <Description></Description>
8
    <Configurations>Debug;Release;Test</Configurations>
8 9
  </PropertyGroup>
9 10

  
10 11
  <PropertyGroup>
......
18 19
    <DocumentationFile>..\..\..\..\..\docs\Leuze.Modules.Goal.Domain.xml</DocumentationFile>
19 20
  </PropertyGroup>
20 21

  
22
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Test|AnyCPU'">
23
    <OutputPath>..\..\..\..\Presentation\Leuze.Modules\</OutputPath>
24
    <DocumentationFile>..\..\..\..\..\docs\Leuze.Modules.Goal.Domain.xml</DocumentationFile>
25
  </PropertyGroup>
26

  
21 27
  <ItemGroup>
22 28
    <ProjectReference Include="..\..\..\..\Core\Domain\Leuze.Core.Domain\Leuze.Core.Domain.csproj" />
23 29
  </ItemGroup>
src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Leuze.Modules.Goal.Infrastructure.Persistence.csproj
5 5
    <RootNamespace>Leuze.Modules.Goal.Infrastructure.Persistence</RootNamespace>
6 6
    <Product></Product>
7 7
    <Description></Description>
8
    <Configurations>Debug;Release;Test</Configurations>
8 9
  </PropertyGroup>
9 10

  
10 11
  <PropertyGroup>
......
18 19
    <DocumentationFile>..\..\..\..\..\docs\Leuze.Modules.Goal.Infrastructure.Persistence.xml</DocumentationFile>
19 20
  </PropertyGroup>
20 21

  
22
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Test|AnyCPU'">
23
    <OutputPath>..\..\..\..\Presentation\Leuze.Modules\</OutputPath>
24
    <DocumentationFile>..\..\..\..\..\docs\Leuze.Modules.Goal.Infrastructure.Persistence.xml</DocumentationFile>
25
  </PropertyGroup>
26

  
21 27
  <ItemGroup>
22 28
    <ProjectReference Include="..\..\..\..\Core\Infrastructure\Leuze.Core.Infrastructure.Persistence\Leuze.Core.Infrastructure.Persistence.csproj" />
23 29
    <ProjectReference Include="..\..\Domain\Leuze.Modules.Goal.Domain\Leuze.Modules.Goal.Domain.csproj" />
src/Presentation/Leuze.App/Leuze.App.csproj
5 5
    <RootNamespace>Leuze.App</RootNamespace>
6 6
    <Product></Product>
7 7
    <Description></Description>
8
    <Configurations>Debug;Release;Test</Configurations>
8 9
  </PropertyGroup>
9 10

  
10 11
  <PropertyGroup>
......
18 19
    <DocumentationFile>..\..\..\docs\Leuze.App.xml</DocumentationFile>
19 20
  </PropertyGroup>
20 21

  
22
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Test|AnyCPU'">
23
    <DocumentationFile>..\..\..\docs\Leuze.App.xml</DocumentationFile>
24
  </PropertyGroup>
25

  
21 26
  <ItemGroup>
22 27
    <Resource Include="wwwroot\Resources\Icons\microsoft-logo.svg">
23 28
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
tests/Core/Leuze.Tests.Core.Domain/Leuze.Tests.Core.Domain.csproj
5 5
    <RootNamespace>Leuze.Tests.Core.Domain</RootNamespace>
6 6
    <Product></Product>
7 7
    <Description></Description>
8
    <Configurations>Debug;Release;Test</Configurations>
8 9
  </PropertyGroup>
9 10

  
10 11
  <PropertyGroup>
......
18 19
    <DocumentationFile>..\..\..\docs\Leuze.Tests.Core.Domain.xml</DocumentationFile>
19 20
  </PropertyGroup>
20 21

  
22
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Test|AnyCPU'">
23
    <DocumentationFile>..\..\..\docs\Leuze.Tests.Core.Domain.xml</DocumentationFile>
24
  </PropertyGroup>
25

  
21 26
  <ItemGroup>
22 27
    <PackageReference Include="FluentAssertions" Version="5.10.3" />
23 28
    <PackageReference Include="JunitXml.TestLogger" Version="2.1.81" />
tests/Core/Leuze.Tests.Core/Leuze.Tests.Core.csproj
4 4
    <TargetFramework>net5.0</TargetFramework>
5 5

  
6 6
    <IsPackable>false</IsPackable>
7

  
8
    <Configurations>Debug;Release;Test</Configurations>
7 9
  </PropertyGroup>
8 10

  
9 11
  <ItemGroup>
tests/Leuze.Tests.Configuration/Leuze.Tests.Configuration.csproj
5 5
    <RootNamespace>Leuze.Tests.Configuration</RootNamespace>
6 6
    <Product></Product>
7 7
    <Description></Description>
8
    <Configurations>Debug;Release;Test</Configurations>
8 9
  </PropertyGroup>
9 10
  
10 11
  <PropertyGroup>
......
17 18
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
18 19
    <DocumentationFile>..\..\docs\Leuze.Tests.Configuration.xml</DocumentationFile>
19 20
  </PropertyGroup>
21
  
22
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Test|AnyCPU'">
23
    <DocumentationFile>..\..\docs\Leuze.Tests.Configuration.xml</DocumentationFile>
24
  </PropertyGroup>
20 25

  
21 26
  <ItemGroup>
22 27
    <PackageReference Include="AutoMapper" Version="10.1.1" />
tests/Leuze.Tests.Configuration/Utilities.cs
22 22
            List<Assembly> loadedAssemblies = new List<Assembly>();
23 23

  
24 24
            string workingDirectory = Environment.CurrentDirectory;
25
#if TEST
26
            string projectDirectory = Directory.GetParent(workingDirectory).Parent.Parent.Parent.FullName;
27
#else
25 28
            string projectDirectory = Directory.GetParent(workingDirectory).Parent.Parent.Parent.Parent.Parent.FullName;
29
#endif
30

  
26 31

  
27 32
            // Loop through all dll files in directory
28 33
            foreach (FileInfo file in new DirectoryInfo(Path.Combine(projectDirectory, "src", "Presentation", "Leuze.Modules", "net5.0")).GetFiles("*.dll"))

Také k dispozici: Unified diff