Esempio n. 1
0
        public async Task ReadAsync_ShouldReturnFullMessageOnly()
        {
            var sut = new TestInterface(new MemoryStream());

            sut.WriteWithDelay(0x07, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x09);

            var result = await sut.ReadAsync(CancellationToken.None);

            var actual   = result.Dump();
            var expected = "07-01-02-03-04-05-06-07";

            actual.ShouldEqual(expected);
        }
Esempio n. 2
0
        public async Task ReadAsync_ShouldReturnFullMessageEvenWhenReceivedDataIsChunked()
        {
            var sut = new TestInterface(new MemoryStream());

            var data = new List <byte[]>()
            {
                new byte[] { 0x07 },
                new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 }
            };

            sut.WriteChunksWithDelay(data);

            var result = await sut.ReadAsync(CancellationToken.None);

            var actual   = result.Dump();
            var expected = "07-01-02-03-04-05-06-07";

            actual.ShouldEqual(expected);
        }