parent
11227391d3
commit
d9f417ee19
17 changed files with 1084 additions and 381 deletions
24
Projects/Server.Tests/AssertExtensions.cs
Normal file
24
Projects/Server.Tests/AssertExtensions.cs
Normal 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)}"
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue