示例#1
0
        public async Task TestPeek()
        {
            var reader = new NetworkReader(baseStream);

            Assert.AreEqual <char?>('\u2661', await reader.PeekCharAsync().ConfigureAwait(false));
            Assert.AreEqual <char?>('\u2661', await reader.PeekCharAsync().ConfigureAwait(false));
            Assert.AreEqual <char?>('\u2661', await reader.ReadCharAsync().ConfigureAwait(false));
        }
示例#2
0
        public async Task TestBrokenRead()
        {
            var reader = new NetworkReader(baseStream);

            // remove the first byte to kill the char
            Assert.AreEqual(
                BitConverter.ToString(new byte[] { 0xe2 }),
                BitConverter.ToString(await reader.ReadBytesAsync(1))
                );
            // read an undefined char
            Assert.AreEqual(65533, (int)(await reader.ReadCharAsync().ConfigureAwait(false)));
        }