Example #1
0
        public async Task The_ReadAsync_Method_Throws_When_Length_Is_Negative()
        {
            var reader = new AsyncBinaryReader(new MemoryStream());

            await Assert.ThrowsAsync <ArgumentException>(async() =>
            {
                await reader.ReadAsync(-1);
            });
        }
Example #2
0
        public async Task The_ReadAsync_Method_Works()
        {
            var expected = Encoding.UTF8.GetBytes("123456");
            var stream   = new MemoryStream(expected);
            var reader   = new AsyncBinaryReader(stream);

            var actual = await reader.ReadAsync(expected.Length);

            Assert.Equal(expected, actual);
        }