public static void PeekTag_InvalidTypes_ShouldThrowInvalidOperationException(string hexEncoding) { byte[] encoding = hexEncoding.HexToByteArray(); var reader = new CborReader(encoding); Assert.Throws <InvalidOperationException>(() => reader.PeekTag()); Assert.Equal(encoding.Length, reader.BytesRemaining); }
public static void PeekTag_SingleValue_HappyPath(ulong expectedTag, string hexEncoding) { byte[] encoding = hexEncoding.HexToByteArray(); var reader = new CborReader(encoding); Assert.Equal(CborReaderState.Tag, reader.PeekState()); CborTag tag = reader.PeekTag(); Assert.Equal(expectedTag, (ulong)tag); Assert.Equal(CborReaderState.Tag, reader.PeekState()); Assert.Equal(encoding.Length, reader.BytesRemaining); }
public static void PeekTag_InvalidType_UnsupportedConformanceMode_ShouldThrowInvalidOperationException(CborConformanceMode mode, string hexEncoding) { var reader = new CborReader(hexEncoding.HexToByteArray(), mode); Assert.Throws <InvalidOperationException>(() => reader.PeekTag()); }
public static void PeekTag_SupportedConformanceMode_ShouldSucceed(CborConformanceMode mode, string hexEncoding) { var reader = new CborReader(hexEncoding.HexToByteArray(), mode); reader.PeekTag(); }
public static void PeekTag_UnsupportedConformanceLevel_ShouldThrowFormatException(CborConformanceLevel level, string hexEncoding) { var reader = new CborReader(hexEncoding.HexToByteArray(), level); Assert.Throws <FormatException>(() => reader.PeekTag()); }
public static void PeekTag_UnsupportedConformanceLevel_ShouldSucceed(CborConformanceLevel level, string hexEncoding) { var reader = new CborReader(hexEncoding.HexToByteArray(), level); reader.PeekTag(); }