Esempio n. 1
0
        public void StartsWithZero_Compressed()
        {
            //Arrange
            byte[]       originalBytes           = { 16, 243, 56, 63, 240, 12, 1 };
            byte[]       expectedCompressedBytes = { 3, 1, 4, 4, 2, 2, 2, 3, 5, 10, 8, 2, 9, 1 };
            Stream       originalStream          = new MemoryStream(originalBytes);
            MemoryStream compressedStream        = new MemoryStream();

            //Act
            RunLengthEncoding.Compress(originalStream, compressedStream);
            byte[] compressedBytes = compressedStream.ToArray();
            originalStream.Dispose();
            compressedStream.Dispose();

            //Assert
            Assert.True(expectedCompressedBytes.SequenceEqual(compressedBytes));
        }