public void TestDirectoryGetFiles()
        {
            var file1 = Mocks.Of<IPackageEntry>()
               .Where(info => info.FullPath == @"a%60b\c%60d.txt")
               .First();

            var file2 = Mocks.Of<IPackageEntry>()
               .Where(info => info.FullPath == @"e%60f\g%60h.txt")
               .First();

            var directory = Mocks.Of<IPackageFile>()
                .Where(info => info.Entries == new[] { file1, file2 })
                .First();

            var wrapper = new TransformingWrapperPackageFile(directory, new UrlTransformation());
            var files = wrapper.Entries.ToArray();
            Assert.Equal(2, files.Length);
            Assert.Equal(@"a`b\c`d.txt", files[0].FullPath);
            Assert.Equal(@"e`f\g`h.txt", files[1].FullPath);
        }
        private void CreateJob(PackageProject metadata, byte[] data)
        {
            string directory = Path.Combine(metadata.Name, metadata.Version.Name);
            Directory.CreateDirectory(Path.Combine(configuration.DataPath, directory));

            string file = Path.Combine(configuration.DataPath, directory, metadata.Name + ".symbols.zip");
            if (File.Exists(file))
            {
                File.Delete(file);
            }
            File.WriteAllBytes(file, data);

            using (var zipMemoryStream = new MemoryStream (data))
            using (var zipfile = ZipFile.Read(zipMemoryStream))
            {
                var zipInfo = new TransformingWrapperPackageFile(new ZipPackageFile(zipfile), new UrlTransformation());
                var addInfo = addInfoBuilder.Build(zipInfo);

                string binariesDirectory = Path.Combine(directory, "Binaries");
                Directory.CreateDirectory(Path.Combine(configuration.DataPath, binariesDirectory));
                string sourcesDirectory = Path.Combine(directory, "Sources");
                Directory.CreateDirectory(Path.Combine(configuration.DataPath, sourcesDirectory));

                foreach (var binaryInfo in addInfo.Binaries)
                {
                    if (binaryInfo.SymbolInfo == null)
                        continue;

                    if (binaryInfo.SymbolHash != binaryInfo.SymbolInfo.Hash)
                        throw new InvalidOperationException(string.Format("Incorrect hash code for '{0}' binaryHash '{1}' symbolHash '{2}'.", binaryInfo.Name, binaryInfo.SymbolHash, binaryInfo.SymbolInfo.Hash));

                    string binaryDirectory = Path.Combine(binariesDirectory, binaryInfo.Name, binaryInfo.SymbolHash);
                    Directory.CreateDirectory(Path.Combine(configuration.DataPath, binaryDirectory));

                    using (var binaryInfoStream = binaryInfo.File.Stream)
                    {
                        using (var binaryStream = File.OpenWrite(Path.Combine(configuration.DataPath, binaryDirectory, binaryInfo.Name + "." + binaryInfo.Type)))
                            binaryInfoStream.CopyTo(binaryStream);
                    }

                    using (var symbolInfoStream = binaryInfo.SymbolInfo.File.Stream)
                    {
                        using (var symbolStream = File.OpenWrite(Path.Combine(configuration.DataPath, binaryDirectory, binaryInfo.Name + "." + binaryInfo.SymbolInfo.Type)))
                            symbolInfoStream.CopyTo(symbolStream);
                    }

                    string indexDirectory = Path.Combine(configuration.IndexPath, binaryInfo.Name);
                    Directory.CreateDirectory(indexDirectory);

                    File.AppendAllText(Path.Combine(indexDirectory, binaryInfo.SymbolHash + ".txt"), binaryDirectory + Environment.NewLine);

                    var sourceIndex = new List<string>();

                    foreach (var sourceInfo in binaryInfo.SymbolInfo.SourceInfos.Where(info => info.ActualPath != null))
                    {
                        string sourcePath = Path.Combine(sourcesDirectory, sourceInfo.KeyPath.Replace(":/", ""));
                        Directory.CreateDirectory(Path.Combine(configuration.DataPath, Path.GetDirectoryName(sourcePath)));

                        sourceIndex.Add(sourceInfo.OriginalPath + "|" + sourceInfo.KeyPath.Replace(":/", ""));

                        using (var sourceInfoStream = sourceInfo.ActualPath.Stream)
                        {
                            using (var convertedStream = SourceConverter.Convert(sourceInfoStream))
                            {
                                using (var sourceStream = File.OpenWrite(Path.Combine(configuration.DataPath, sourcePath)))
                                    convertedStream.CopyTo(sourceStream);
                            }
                        }
                    }

                    var txtFile = Path.Combine(configuration.DataPath, binaryDirectory, binaryInfo.Name + ".txt");
                    if (File.Exists(txtFile))
                    {
                        File.Delete(txtFile);
                    }
                    File.WriteAllLines(txtFile, sourceIndex.ToArray());
                }
            }

            File.Delete(file);
        }