public void DecompressStreamAsync_ThrowsException_WithUnsupportedCompression(TiffCompression compression) { var stream = new StreamBuilder(ByteOrder.LittleEndian).ToStream(); var e = Assert.Throws <NotSupportedException>(() => { TiffDecompressor.DecompressStreamAsync(stream, compression, 100, 100); }); Assert.Equal($"The compression format '{compression}' is not supported.", e.Message); }
new byte[] { 0xAA, 0xAA, 0xAA, 0x80, 0x00, 0x2A, 0xAA, 0xAA, 0xAA, 0xAA, 0x80, 0x00, 0x2A, 0x22, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA })] // Apple PackBits sample public async Task DecompressStreamAsync_DecompressData_PackBits(byte[] compressedData, byte[] uncompressedData) { var stream = new StreamBuilder(ByteOrder.LittleEndian) .WriteBytes(compressedData) .ToStream(); var data = await TiffDecompressor.DecompressStreamAsync(stream, TiffCompression.PackBits, compressedData.Length, uncompressedData.Length); Assert.Equal(uncompressedData, data); }
public async Task DecompressStreamAsync_DecompressData_NoCompression() { var stream = new StreamBuilder(ByteOrder.LittleEndian) .WriteBytes(new byte[] { 10, 20, 30, 40, 50, 40, 30, 20, 10, 20, 40, 60, 80 }) .ToStream(); var data = await TiffDecompressor.DecompressStreamAsync(stream, TiffCompression.None, 11, 11); Assert.Equal(new byte[] { 10, 20, 30, 40, 50, 40, 30, 20, 10, 20, 40 }, data); }
public void SupportsCompression_ReturnsCorrectValue(TiffCompression compression, bool expectedResult) { var supported = TiffDecompressor.SupportsCompression(compression); Assert.Equal(expectedResult, supported); }