Exemplo n.º 1
0
        public virtual async Task EmptyStreamAsyncTest()
        {
            var ms = new MemoryStream();
            await _formatter.WriteToStreamAsync(typeof(SerializerPocoSerializable), default(SerializerPocoSerializable), ms, null);

            ms.Position = 0;
            var obj = await _formatter.ReadFromStreamAsync(typeof(SerializerPocoSerializable), ms, null);

            Assert.Null(obj);

            var emptyBytes = await _formatter.SerializeObjectAsync(default(SerializerPocoSerializable));

            Assert.Empty(emptyBytes);

            var emptySegment = await _formatter.WriteToMemoryPoolAsync(default(SerializerPocoSerializable));

            Assert.True(0 == emptySegment.Count);
            Assert.Empty(emptySegment.Array);
        }