public void RoundTrip([Range(0, 32, 1)] int length) { var original = new byte[length]; lock (_random) _random.NextBytes(original); byte[] decoded; var code64 = SortableBase64.Encode(original); var result = SortableBase64.TryDecode(code64, out decoded); result.Should().BeTrue(); decoded.Should().Equal(original); }
public void Encode_3() { SortableBase64.Encode(new byte[] { 0x00, 0x00, 0x00 }).Should().Be("...."); // 000000|00 0000|0000 00|000000 SortableBase64.Encode(new byte[] { 0x04, 0x10, 0x41 }).Should().Be("0000"); // 000001|00 0001|0000 01|000001 SortableBase64.Encode(new byte[] { 0xA5, 0xA5, 0xA5 }).Should().Be("dPL_"); // 101001|01 1010|0101 10|100101 }
public void Encode_1() { SortableBase64.Encode(new byte[] { 0x00 }).Should().Be(".."); // 000000|00 (0000) SortableBase64.Encode(new byte[] { 0x04 }).Should().Be("0."); // 000001|00 (0000) SortableBase64.Encode(new byte[] { 0xA5 }).Should().Be("dF"); // 101001|01 (0000) }
public void Encode_2() { SortableBase64.Encode(new byte[] { 0x00, 0x00 }).Should().Be("..."); // 000000|00 0000|0000 (00) SortableBase64.Encode(new byte[] { 0x04, 0x10 }).Should().Be("00."); // 000001|00 0001|0000 (00) SortableBase64.Encode(new byte[] { 0xA5, 0xA5 }).Should().Be("dPJ"); // 101001|01 1010|0101 (00) }
public void Encode_Empty() { SortableBase64.Encode(new byte[] { }).Should().Be(""); }