fix(core): Converts more packets and switches to Moq (#415)
- [X] Switches testing to moq for mocking - [X] Converts race changer packets - [X] Renames some more folders and misc cleanup
This commit is contained in:
parent
fbafd7210d
commit
b4b1b0b122
144 changed files with 197 additions and 181 deletions
|
|
@ -1,4 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Sockets;
|
||||
using Moq;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Tests.Network
|
||||
|
|
@ -8,7 +11,18 @@ namespace Server.Tests.Network
|
|||
public static Span<byte> Compile(this Packet p) =>
|
||||
p.Compile(false, out var length).AsSpan(0, length);
|
||||
|
||||
public static NetState CreateTestNetState() =>
|
||||
new(new MockSocket());
|
||||
public static NetState CreateTestNetState()
|
||||
{
|
||||
var socket = new Mock<ISocket>();
|
||||
socket
|
||||
.Setup(s => s.SendAsync(It.IsAny<IList<ArraySegment<byte>>>(), SocketFlags.None))
|
||||
.ReturnsAsync(() => 0);
|
||||
|
||||
socket
|
||||
.Setup(s => s.ReceiveAsync(It.IsAny<IList<ArraySegment<byte>>>(), SocketFlags.None))
|
||||
.ReturnsAsync(() => 0);
|
||||
|
||||
return new NetState(socket.Object);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue