Exemplo n.º 1
0
        public void WriteBlock_WriteAllFromArray_AllDataIsWritten()
        {
            // Arrange
            var           result             = new byte[3];
            IOutputStream memoryOutputStream = new MemoryOutputStream(result);
            var           data = new byte[] { 1, 2, 3 };

            // Act
            memoryOutputStream.WriteBlock(data, size: ( uint )data.Length);
            memoryOutputStream.Dispose();

            // Assert
            Assert.True(result.SequenceEqual(data));
        }
Exemplo n.º 2
0
        public void WriteBlock_WriteFirstByteFromArray_WrittenOnlyOneByte()
        {
            // Arrange
            var           result             = new byte[1];
            IOutputStream memoryOutputStream = new MemoryOutputStream(result);
            var           expectedData       = new byte[] { 1 };

            // Act
            memoryOutputStream.WriteBlock(new byte[] { 1, 2 }, size: 1);
            memoryOutputStream.Dispose();

            // Assert
            Assert.True(result.SequenceEqual(expectedData));
        }