Ejemplo n.º 1
0
        public async Task When_reading_a_structure_from_a_stream_that_is_too_short()
        {
            var sut = new AsyncBinaryReader(new TestStream(
                0, 0, 0, 0,
                1, 0, 0, 0,
                2, 0, 0, 0,
                3, 0, 0, 0,
                4, 0, 0, 0
            ));

            await Assert.ThrowsAsync<EndOfStreamException>(async () =>
            {
                await sut.ReadStructureAsync<Symblr.Symbols.Pdb70.Pdb70Header>(CancellationToken.None);
            });
        }
Ejemplo n.º 2
0
        public async Task When_reading_a_structure()
        {
            var sut = new AsyncBinaryReader(new TestStream(
                0, 0, 0, 0,
                1, 0, 0, 0,
                2, 0, 0, 0,
                3, 0, 0, 0,
                4, 0, 0, 0,
                5, 0, 0, 0
            ));

            var str = await sut.ReadStructureAsync<Symblr.Symbols.Pdb70.Pdb70Header>(CancellationToken.None);
            Assert.Equal(0, str.PageSize);
            Assert.Equal(1, str.BitmapPage);
            Assert.Equal(2, str.PageCount);
            Assert.Equal(3, str.IndexBytes);
            Assert.Equal(4, str.Reserved);
            Assert.Equal(5, str.IndexPage);
        }