예제 #1
0
        public static void ReadByteString_SingleValue_HappyPath(string hexExpectedValue, string hexEncoding)
        {
            byte[] encoding      = hexEncoding.HexToByteArray();
            byte[] expectedValue = hexExpectedValue.HexToByteArray();
            var    reader        = new CborValueReader(encoding);

            byte[] output = reader.ReadByteString();
            Assert.Equal(expectedValue, output);
        }
예제 #2
0
        public static void Roundtrip_ByteString(string?hexInput)
        {
            byte[]? input = hexInput?.HexToByteArray();
#endif
            using var writer = new CborWriter();
            writer.WriteByteString(input);
            byte[] encoding = writer.ToArray();

            var    reader = new CborValueReader(encoding);
            byte[] result = reader.ReadByteString();
            AssertHelper.HexEqual(input ?? Array.Empty <byte>(), result);
        }