Skip to content
Merged

fixes #2052

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
using NosCore.GameObject.InterChannelCommunication.Hubs.PubSub;
using NosCore.GameObject.Networking.ClientSession;
using NosCore.GameObject.Services.LoginService;
using NosCore.Networking;
using NosCore.Networking.SessionRef;
using NosCore.PacketHandlers.Login;
using NosCore.Packets.ClientPackets.Login;
Expand All @@ -54,6 +55,7 @@ public class NoS0575PacketHandlerTests
private NoS0575PacketHandler? _noS0575PacketHandler;
private ClientSession? _session;
private Mock<IChannelHub>? _channelHub;
private SessionRefHolder? _sessionRefHolder;

[TestInitialize]
public async Task SetupAsync()
Expand All @@ -64,10 +66,12 @@ public async Task SetupAsync()
_authHttpClient = new Mock<IAuthHub>();
_pubSubHub = TestHelpers.Instance.PubSubHub;
_loginConfiguration = Options.Create(new LoginConfiguration());
_sessionRefHolder = new SessionRefHolder();
_channelHub = new Mock<IChannelHub>();
_sessionRefHolder![_session!.Channel!.Id] = new RegionTypeMapping(_session.SessionId, RegionType.EN);
_noS0575PacketHandler = new NoS0575PacketHandler(new LoginService(_loginConfiguration,
TestHelpers.Instance.AccountDao,
_authHttpClient.Object, _pubSubHub.Object, _channelHub!.Object, TestHelpers.Instance.CharacterDao, new SessionRefHolder()),
_authHttpClient.Object, _pubSubHub.Object, _channelHub!.Object, TestHelpers.Instance.CharacterDao, _sessionRefHolder!),
_loginConfiguration, Logger, TestHelpers.Instance.LogLanguageLocalizer);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
using NosCore.GameObject.InterChannelCommunication.Hubs.PubSub;
using NosCore.GameObject.Networking.ClientSession;
using NosCore.GameObject.Services.LoginService;
using NosCore.Networking;
using NosCore.Networking.SessionRef;
using NosCore.PacketHandlers.Login;
using NosCore.Packets.ClientPackets.Login;
Expand Down Expand Up @@ -61,6 +62,7 @@ public class NoS0577PacketHandlerTests
private NoS0577PacketHandler? _noS0577PacketHandler;
private ClientSession? _session;
private Mock<IChannelHub>? _channelHub;
private SessionRefHolder? _sessionRefHolder;

private static string GuidToToken(string token)
{
Expand All @@ -72,13 +74,15 @@ public async Task SetupAsync()
{
await TestHelpers.ResetAsync().ConfigureAwait(false);
_channelHub = new Mock<IChannelHub>();
_sessionRefHolder = new SessionRefHolder();
_session = await TestHelpers.Instance.GenerateSessionAsync().ConfigureAwait(false);
_sessionRefHolder[_session.Channel!.Id] = new RegionTypeMapping(_session.SessionId, RegionType.EN);
_authHttpClient.Setup(s => s.GetAwaitingConnectionAsync(It.IsAny<string>(), It.IsAny<string>(),
It.IsAny<int>())).ReturnsAsync((string a, string b, int c) =>
(string?)((new OkObjectResult(_session.Account.Name)).Value));
_noS0577PacketHandler = new NoS0577PacketHandler(new LoginService(_loginConfiguration,
TestHelpers.Instance.AccountDao,
_authHttpClient.Object, _pubSubHub.Object, _channelHub.Object, TestHelpers.Instance.CharacterDao, new SessionRefHolder()));
_authHttpClient.Object, _pubSubHub.Object, _channelHub.Object, TestHelpers.Instance.CharacterDao, _sessionRefHolder));
SessionFactory.Instance.AuthCodes[_tokenGuid] = _session.Account.Name;
SessionFactory.Instance.ReadyForAuth.Clear();
}
Expand Down
Loading