public void ReadsBooleans(bool value, byte[] encoding) { var stream = new MemoryStream(encoding); using (stream) { Assert.Equal(value, Codec.ReadBoolean(stream)); Assert.Equal(encoding.Length, stream.Position); } }
public void ReadsBooleans(bool value, byte[] encoding) { var input = Expression.Parameter(typeof(Stream)); var read = (Func <Stream, bool>)Expression.Lambda(Codec.ReadBoolean(input), new[] { input }).Compile(); using (var stream = new MemoryStream(encoding)) { Assert.Equal(value, read(stream)); Assert.Equal(encoding.Length, stream.Position); } }