Skip to content

Commit

Permalink
cw
Browse files Browse the repository at this point in the history
  • Loading branch information
juuwel committed Apr 25, 2024
1 parent a53af0a commit ac4ece7
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Tests/AuthTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Reactive.Linq;
using api.Events.Auth.Client;
using api.Events.Auth.Server;
using api.Events.Global;
Expand All @@ -13,11 +14,11 @@ public class AuthTests : TestBase
public async Task RegisterLogInLogOut()
{
var ws = await new WebSocketTestClient().ConnectAsync();
ws.Client.MessageReceived.Subscribe(m => Console.WriteLine(m.Text));

var registerUserDto = GenerateRandomRegisterUserDto();
await ws.DoAndAssert(new ClientWantsToSignUpDto { RegisterUserDto = registerUserDto }, receivedMessages =>
{
receivedMessages.ForEach(e => Console.WriteLine(e.eventType));
return receivedMessages.Count(e => e.eventType == nameof(ServerSignsUserUp)) == 1;
});

Expand All @@ -29,13 +30,11 @@ await ws.DoAndAssert(new ClientWantsToSignUpDto { RegisterUserDto = registerUser

await ws.DoAndAssert(new ClientWantsToLogInDto { LoginDto = loginDto }, receivedMessages =>
{
receivedMessages.ForEach(e => Console.WriteLine(e.eventType));
return receivedMessages.Count(e => e.eventType == nameof(ServerAuthenticatesUser)) == 1;
});

await ws.DoAndAssert(new ClientWantsToLogOutDto { UserEmail = registerUserDto.Email }, receivedMessages =>
{
receivedMessages.ForEach(e => Console.WriteLine(e.eventType));
return receivedMessages.Count(e => e.eventType == nameof(ServerLogsOutUser)) == 1;
});
}
Expand Down

0 comments on commit ac4ece7

Please sign in to comment.