public async Task Encode_DecodeRoundtrip_ReturnsInput(ulong input) { var pipe = new Pipe(); await VarUInt.Encode(input, pipe.Writer); Assert.That(VarUInt.Decode(pipe.Reader), Is.EqualTo(input)); }
public void Decode_MissingFollowup_Throws() { var stream = PipeReader.Create(new MemoryStream(new byte[] { 172 })); Assert.That(() => VarUInt.Decode(stream), Throws.Exception); }
public ulong Decode_FullInput_ReturnsCorrectValue(byte[] input) { var str = PipeReader.Create(new MemoryStream(input)); return(VarUInt.Decode(str)); }