mirror of
https://github.com/SabreTools/SabreTools.IO.git
synced 2026-02-14 05:36:25 +00:00
31 lines
1012 B
C#
31 lines
1012 B
C#
using System;
|
|
using System.IO;
|
|
using SabreTools.IO.Compression.MSZIP;
|
|
using SabreTools.IO.Extensions;
|
|
using Xunit;
|
|
|
|
namespace SabreTools.IO.Test.Compression
|
|
{
|
|
public class MSZIPTests
|
|
{
|
|
[Fact]
|
|
public void DecompressorTest()
|
|
{
|
|
// Testing Note: This is a fake file that has multiple blocks
|
|
// sequentially. In real cabinet files, these are embedded in
|
|
// CFDATA blocks.
|
|
string path = Path.Combine(Environment.CurrentDirectory, "TestData", "test-archive.msz");
|
|
byte[] inputBytes = File.ReadAllBytes(path);
|
|
MemoryStream input = new MemoryStream(inputBytes);
|
|
MemoryStream output = new MemoryStream();
|
|
|
|
var decompressor = Decompressor.Create();
|
|
input.SeekIfPossible(0x0000);
|
|
decompressor.CopyTo(input, output);
|
|
input.SeekIfPossible(0x3969);
|
|
decompressor.CopyTo(input, output);
|
|
|
|
Assert.Equal(38470, output.Length);
|
|
}
|
|
}
|
|
} |