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
|
}
|