public void TarReaderWriterFiles()
        {
            var tempFileName = Path.GetTempFileName();
            var checks       = new Dictionary <string, byte[]>();
            var random       = new Random();

            var temp1 = GetTempDir();
            var temp2 = GetTempDir();

            using (var stream = File.Create(tempFileName))
            {
                using (var writer = new TarWriter(stream, true))
                {
                    for (var i = 0; i < 1000; i++)
                    {
                        var buffer   = new byte[random.Next(64 * 1024)];
                        var name     = $"{i % 10}/{i}.txt";
                        var fullName = Path.Combine(temp1, name);
                        Directory.CreateDirectory(Path.GetDirectoryName(fullName));
                        File.WriteAllBytes(fullName, buffer);
                        checks.Add(name, buffer);
                    }
                    writer.AddDirectory("/", temp1);
                }
            }

            using (var stream = File.OpenRead(tempFileName))
            {
                using (var reader = new TarReader(stream, true))
                {
                    reader.UnpackTo(temp2);
                }
            }

            using (var stream = File.OpenRead(tempFileName))
            {
                using (var reader = new TarReader(stream, true))
                {
                    var copy = checks.ToDictionary(i => i.Key, i => i.Value);
                    while (reader.ReadNext(out var entry, out var content))
                    {
                        var name = entry.Name.TrimStart('/');
                        if (!copy.TryGetValue(name, out var expectedContent))
                        {
                            Assert.Fail("Entry name not found at source!");
                        }

                        copy.Remove(name);
                        CollectionAssert.AreEqual(expectedContent, content);
                        CollectionAssert.AreEqual(expectedContent, File.ReadAllBytes(Path.Combine(temp1, name)));
                        CollectionAssert.AreEqual(expectedContent, File.ReadAllBytes(Path.Combine(temp2, name)));
                    }
                }
            }

            Directory.Delete(temp1, true);
            Directory.Delete(temp2, true);
        }