Fix bad serials (#304)

- [X] Fixes bad serial calculations
- [X] Tightens HexStrings

Bumps release version
Updates documentation
This commit is contained in:
Kamron Batman 2020-11-08 12:09:26 -08:00 • committed by GitHub
parent b0c1076cb5
commit ae436cb55f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
46 changed files with 76 additions and 51 deletions

View file

@ -0,0 +1,15 @@
using System;
using System.Text;
namespace Server.Tests
{
public static class AssertThat
{
// TODO: Swap actual and expected to match Assert
public static void Equal(ReadOnlySpan<byte> actual, ReadOnlySpan<byte> expected) =>
Xunit.Assert.True(
expected.SequenceEqual(actual),
$"Expected does not match actual.\nExpected:\t{expected.ToDelimitedHexString()}\nActual:\t\t{actual.ToDelimitedHexString()}"
);
}
}

View file

@ -0,0 +1,16 @@
using System.Text;
namespace Server.Tests
{
public static class EncodingHelpers
{
public static Encoding GetEncoding(string bodyname) =>
bodyname switch
{
"utf-8" => Utility.UTF8,
"utf-16" => Utility.UnicodeLE,
"utf-16BE" => Utility.Unicode,
_ => Encoding.ASCII
};
}
}