예제 #1
0
        public static void ReadCborNegativeIntegerEncoding_SingleValue_HappyPath(ulong expectedResult, string hexEncoding)
        {
            byte[] data         = hexEncoding.HexToByteArray();
            var    reader       = new CborValueReader(data);
            ulong  actualResult = reader.ReadCborNegativeIntegerEncoding();

            Assert.Equal(expectedResult, actualResult);
        }
예제 #2
0
 public static void ReadCborNegativeIntegerEncoding_InvalidData_ShouldThrowFormatException(string hexEncoding)
 {
     byte[] data = hexEncoding.HexToByteArray();
     Assert.Throws <FormatException>(() =>
     {
         var reader = new CborValueReader(data);
         reader.ReadCborNegativeIntegerEncoding();
     });
 }
예제 #3
0
        public static void ReadCborNegativeIntegerEncoding_InvalidTypes_ShouldThrowInvalidOperationException(string hexEncoding)
        {
            byte[] data = hexEncoding.HexToByteArray();
            InvalidOperationException exn = Assert.Throws <InvalidOperationException>(() =>
            {
                var reader = new CborValueReader(data);
                reader.ReadCborNegativeIntegerEncoding();
            });

            Assert.Equal("Data item major type mismatch.", exn.Message);
        }