Outgoing Packet Tests (Pass #1) (#129)

This commit is contained in:
Kamron Batman 2020-05-04 01:34:51 -07:00 • committed by GitHub
parent 11227391d3
commit d9f417ee19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 1084 additions and 381 deletions

View file

@ -0,0 +1,24 @@
using System;
using System.Text;
namespace Server.Tests
{
public static partial class AssertThat
{
public static string SpanToString(ReadOnlySpan<byte> bytes)
{
StringBuilder builder = new StringBuilder();
builder.Append("[");
builder.AppendJoin(", ", bytes.ToArray());
builder.Append("]");
return builder.ToString();
}
public static void Equal(ReadOnlySpan<byte> expected, ReadOnlySpan<byte> actual) =>
Xunit.Assert.True(
MemoryExtensions.SequenceEqual(expected, actual),
$"Expected does not match actual.\nExpected:\t{SpanToString(expected)}\nActual:\t\t{SpanToString(actual)}"
);
}
}