private ManifestEntry[] CopyChildren()
        {
            var list = new List <ManifestEntry>(Children.Count);

            for (int i = 0; i < Children.Count; i++)
            {
                var child = Children[i];
                switch (child)
                {
                case ManifestSinkDirectory s:
                case ManifestRootDirectory r:
                    throw new InvalidOperationException("Unexpected manifest node.");

                case ManifestDirectory d:
                    var grandChildren = d.CopyChildren();
                    var newDirectory  = CreateDirectory(d.Name, grandChildren);
                    list.Add(newDirectory);
                    break;

                case ManifestFile f:
                    var file = new ManifestFile(f.Name, f.ResourcePath);
                    list.Add(file);
                    break;

                default:
                    throw new InvalidOperationException("Unexpected manifest node.");
                }
            }

            return(list.ToArray());
        }
        public void TraversingAFile_ReturnsUnknownPath()
        {
            // Arrange
            var file = new ManifestFile("a", "a.b.c");

            // Act
            var result = file.Traverse(".");

            // Assert
            Assert.Equal(ManifestEntry.UnknownPath, result);
        }
        public ManifestFileInfo(Assembly assembly, ManifestFile file, DateTimeOffset lastModified)
        {
            if (assembly == null)
            {
                throw new ArgumentNullException(nameof(assembly));
            }

            if (file == null)
            {
                throw new ArgumentNullException(nameof(file));
            }

            Assembly     = assembly;
            ManifestFile = file;
            LastModified = lastModified;
        }