Revize 61e57395
Přidáno uživatelem Tomáš Orlovský před téměř 4 roky(ů)
tests/Core/Leuze.Tests.Core/LoginTests.cs | ||
---|---|---|
17 | 17 |
[Trait("Category", "Core")] |
18 | 18 |
public class LoginTests : TestWithDatabase |
19 | 19 |
{ |
20 |
private static (string name, string mail, string pass) USER1 = ("user1", "user@test.com", "kappa123"); |
|
21 |
|
|
22 |
|
|
20 | 23 |
public LoginTests() |
21 | 24 |
{ |
22 | 25 |
var services = new ServiceCollection(); |
... | ... | |
24 | 27 |
|
25 | 28 |
Initialize(services); |
26 | 29 |
|
27 |
ApplicationUser user1 = new ApplicationUser("user1", "user@test.com", false);
|
|
28 |
DatabaseFixture.UserManager.CreateAsync(user1, "kappa123").Wait();
|
|
30 |
ApplicationUser user1 = new ApplicationUser(USER1.name, USER1.mail, false);
|
|
31 |
DatabaseFixture.UserManager.CreateAsync(user1, USER1.pass).Wait();
|
|
29 | 32 |
//DatabaseFixture.UserManager.AddPasswordAsync(user1, "kappa123").Wait(); |
30 | 33 |
} |
31 | 34 |
|
... | ... | |
53 | 56 |
[Fact] |
54 | 57 |
public async Task WrongNameLoginTest() |
55 | 58 |
{ |
56 |
//TODO: AD login implementation |
|
59 |
await _semaphore.WaitAsync(); |
|
60 |
|
|
61 |
IMediator mediator = DatabaseFixture.Services.GetRequiredService<IMediator>(); |
|
62 |
var response = await mediator.Send(new VerifyLocalUser.Command("user@wrong.com", USER1.pass)); |
|
63 |
response.IsSuccess.Should().BeFalse(); |
|
64 |
|
|
65 |
_semaphore.Release(); |
|
57 | 66 |
} |
58 | 67 |
|
59 | 68 |
[Fact] |
60 | 69 |
public async Task WrongPassLoginTest() |
61 | 70 |
{ |
62 |
//TODO: AD login implementation |
|
71 |
await _semaphore.WaitAsync(); |
|
72 |
|
|
73 |
IMediator mediator = DatabaseFixture.Services.GetRequiredService<IMediator>(); |
|
74 |
var response = await mediator.Send(new VerifyLocalUser.Command(USER1.mail, String.Empty)); |
|
75 |
response.IsSuccess.Should().BeFalse(); |
|
76 |
|
|
77 |
_semaphore.Release(); |
|
63 | 78 |
} |
64 | 79 |
|
65 | 80 |
[Fact] |
Také k dispozici: Unified diff
Added simple negative login tests