ModernUO/Projects/Server.Tests/Tests/Utility/HexStringConverterTest.cs
Kamron Batman 525cda5413
Cleanup & Fixes for .NET 5 (#309)
- [X] Fixes several bugs
- [X] Updates more ordinal issues
- [X] Cleans up the code a bit
- [X] Turns classes static that should have been
- [X] Changes TcpServer.Instances to a HashSet

Bumps release version
2020-11-15 10:03:50 -08:00

24 lines
791 B
C#

using System;
using Xunit;
namespace Server.Tests.Accounting
{
public class HexStringConverterTest
{
[Theory, InlineData("ABCDEF1234", new byte[] { 0xAB, 0xCD, 0xEF, 0x12, 0x34 })]
public void TestGetBytes(string input, byte[] bytes)
{
Span<byte> outputBytes = stackalloc byte[input.Length / 2];
HexStringConverter.GetBytes(input, outputBytes);
Assert.Equal(bytes, outputBytes.ToArray());
Assert.Equal(input, bytes.ToHexString());
}
[Theory, InlineData("[AB, CD, EF, 12, 34]", new byte[] { 0xAB, 0xCD, 0xEF, 0x12, 0x34 })]
public void TestsGetStringDelimited(string expected, byte[] bytes)
{
Assert.Equal(expected, bytes.ToDelimitedHexString());
}
}
}