parent
05ff3f2ad9
commit
81486772f6
10 changed files with 60 additions and 161 deletions
|
|
@ -1,7 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Sockets;
|
||||
using Moq;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Tests.Network
|
||||
|
|
@ -11,18 +9,8 @@ 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()
|
||||
{
|
||||
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);
|
||||
}
|
||||
public static NetState CreateTestNetState() => new(
|
||||
new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue