public void RenameItem_WherePathIsDirectoryInSubDirectory_RenamesDirectory()
        {
            var rootName           = FileSystemFixture.GetRootName();
            var rootDirectoryItems = fileSystemFixture.RootDirectoryItems;
            var subDirectoryItems  = fileSystemFixture.SubDirectoryItems;

            var original = (DirectoryInfoContract)subDirectoryItems.Single(i => i.Name == "SubSubDir");
            var renamed  = default(DirectoryInfoContract);

            var gatewayMock = mockingFixture.InitializeGetChildItems(rootName, @"\SubDir", rootDirectoryItems, subDirectoryItems);

            gatewayMock.Setup(g => g.RenameItem(rootName, new DirectoryId(@"\SubDir\SubSubDir"), "SubSubDirRenamed"))
            .Returns(renamed = new DirectoryInfoContract(original.Id.Value.Replace("SubSubDir", "SubSubDirRenamed"), original.Name.Replace("SubSubDir", "SubSubDirRenamed"), original.Created, original.Updated))
            .Verifiable();
            compositionFixture.ExportGateway(gatewayMock.Object);

            var result = new PipelineFixture().Invoke(
                FileSystemFixture.NewDriveCommand,
                @"Rename-Item -Path X:\SubDir\SubSubDir -NewName SubSubDirRenamed",
                @"Get-ChildItem -Path X:\SubDir"
                );

            Assert.AreEqual(subDirectoryItems.Count(), result.Count, "Unexpected number of results");
            CollectionAssert.DoesNotContain(result.Select(p => p.BaseObject).ToArray(), original, "Unrenamed original remains");
            CollectionAssert.Contains(result.Select(p => p.BaseObject).ToArray(), renamed, "Renamed item is missing");

            gatewayMock.VerifyAll();
        }
        public void RenameItemAsync_WherePathIsFile_RenamesFile()
        {
            var rootName           = FileSystemFixture.GetRootName();
            var rootDirectoryItems = fileSystemFixture.RootDirectoryItems;

            var original = (FileInfoContract)rootDirectoryItems.Single(i => i.Name == "File.ext");
            var renamed  = default(FileInfoContract);

            var gatewayMock = mockingFixture.InitializeGetChildItemsAsync(rootName, @"\", rootDirectoryItems);

            gatewayMock.Setup(g => g.RenameItemAsync(rootName, new FileId(@"\File.ext"), "FileRenamed.ext", It.IsAny <Func <FileSystemInfoLocator> >()))
            .ReturnsAsync(renamed = new FileInfoContract(original.Id.Value.Replace("File", "FileRenamed"), original.Name.Replace("File", "FileRenamed"), original.Created, original.Updated, original.Size, original.Hash))
            .Verifiable();
            compositionFixture.ExportAsyncGateway(gatewayMock.Object);

            var result = new PipelineFixture().Invoke(
                FileSystemFixture.NewDriveCommand,
                @"Rename-Item -Path X:\File.ext -NewName FileRenamed.ext",
                @"Get-ChildItem -Path X:\"
                );

            Assert.AreEqual(rootDirectoryItems.Count(), result.Count, "Unexpected number of results");
            CollectionAssert.DoesNotContain(result.Select(p => p.BaseObject).ToArray(), original, "Unrenamed original remains");
            CollectionAssert.Contains(result.Select(p => p.BaseObject).ToArray(), renamed, "Renamed item is missing");

            gatewayMock.VerifyAll();
        }
예제 #3
0
        public void MoveItemAsync_WherePathIsDirectoryInSubDirectory_CopiesDirectory()
        {
            var rootName           = FileSystemFixture.GetRootName();
            var rootDirectoryItems = fileSystemFixture.RootDirectoryItems;
            var subDirectoryItems  = fileSystemFixture.SubDirectoryItems;

            var original = (DirectoryInfoContract)subDirectoryItems.Single(i => i.Name == "SubSubDir");
            var moved    = default(DirectoryInfoContract);

            var gatewayMock = mockingFixture.InitializeGetChildItemsAsync(rootName, @"\SubDir", rootDirectoryItems, subDirectoryItems);

            gatewayMock.Setup(g => g.MoveItemAsync(rootName, new DirectoryId(@"\SubDir\SubSubDir"), "SubSubDirMove", new DirectoryId(@"\SubDir"), It.IsAny <Func <FileSystemInfoLocator> >()))
            .ReturnsAsync(moved = new DirectoryInfoContract(original.Id.Value.Replace("SubSubDir", "SubSubDirMove"), original.Name.Replace("SubSubDir", "SubSubDirMove"), original.Created, original.Updated))
            .Verifiable();
            compositionFixture.ExportAsyncGateway(gatewayMock.Object);

            var result = new PipelineFixture().Invoke(
                FileSystemFixture.NewDriveCommand,
                @"Move-Item -Path X:\SubDir\SubSubDir -Destination X:\SubDir\SubSubDirMove",
                @"Get-ChildItem -Path X:\SubDir"
                );

            Assert.AreEqual(subDirectoryItems.Count(), result.Count, "Unexpected number of results");
            CollectionAssert.DoesNotContain(result.Select(p => p.BaseObject).ToArray(), original, "Original item remains");
            CollectionAssert.Contains(result.Select(p => p.BaseObject).ToArray(), moved, "Moved item is missing");

            gatewayMock.VerifyAll();
        }
        public void CopyItem_WherePathIsFile_CopiesFile()
        {
            var rootName           = FileSystemFixture.GetRootName();
            var rootDirectoryItems = fileSystemFixture.RootDirectoryItems;

            var original = (FileInfoContract)rootDirectoryItems.Single(i => i.Name == "File.ext");
            var copy     = default(FileInfoContract);

            var gatewayMock = mockingFixture.InitializeGetChildItems(rootName, @"\", rootDirectoryItems);

            gatewayMock.Setup(g => g.CopyItem(rootName, new FileId(@"\File.ext"), @"FileCopy.ext", new DirectoryId(@"\"), false))
            .Returns(copy = new FileInfoContract(original.Id.Value.Replace("File", "FileCopy"), original.Name.Replace("File", "FileCopy"), original.Created, original.Updated, original.Size, original.Hash))
            .Verifiable();
            compositionFixture.ExportGateway(gatewayMock.Object);

            var result = new PipelineFixture().Invoke(
                FileSystemFixture.NewDriveCommand,
                @"Copy-Item -Path X:\File.ext -Destination X:\FileCopy.ext",
                @"Get-ChildItem -Path X:\"
                );

            Assert.AreEqual(rootDirectoryItems.Count() + 1, result.Count, "Unexpected number of results");
            CollectionAssert.Contains(result.Select(p => p.BaseObject).ToArray(), original, "Original item is missing");
            CollectionAssert.Contains(result.Select(p => p.BaseObject).ToArray(), copy, "Copied item is missing");

            gatewayMock.VerifyAll();
        }
        public void GetChildItemAsync_WherePathIsSubDirectoryAndForceIsSpecified_RefreshesResult()
        {
            var rootName                   = FileSystemFixture.GetRootName();
            var rootDirectoryItems         = fileSystemFixture.RootDirectoryItems;
            var subDirectoryItems          = fileSystemFixture.SubDirectoryItems;
            var subDirectoryItemsRefreshed = fileSystemFixture.SubDirectoryItems
                                             .Select(f => f is FileInfoContract
                    ? new FileInfoContract(f.Id.Value.Insert(f.Id.Value.IndexOf(".ext", StringComparison.Ordinal), "Refreshed"), f.Name.Insert(f.Name.IndexOf(".ext", StringComparison.Ordinal), "Refreshed"), f.Created, f.Updated, ((FileInfoContract)f).Size, ((FileInfoContract)f).Hash) as FileSystemInfoContract
                    : new DirectoryInfoContract(f.Id + "Refreshed", f.Name + "Refreshed", f.Created, f.Updated) as FileSystemInfoContract)
                                             .ToArray();

            var gatewayMock = new MockingFixture().InitializeGetChildItemsAsync(rootName, string.Empty, rootDirectoryItems);

            gatewayMock.SetupSequence(g => g.GetChildItemAsync(rootName, new DirectoryId(@"\SubDir")))
            .ReturnsAsync(subDirectoryItems)
            .ReturnsAsync(subDirectoryItemsRefreshed)
            .ThrowsAsync(new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, @"Redundant access to \SubDir")));
            compositionFixture.ExportAsyncGateway(gatewayMock.Object);

            var result = new PipelineFixture().Invoke(
                FileSystemFixture.NewDriveCommand,
                @"Get-ChildItem -Path X:\SubDir",
                @"Get-ChildItem -Path X:\SubDir -Force"
                );

            Assert.AreEqual(subDirectoryItemsRefreshed.Length, result.Count, "Unexpected number of results");
            CollectionAssert.AreEquivalent(subDirectoryItemsRefreshed, result.Select(p => p.BaseObject).Cast <FileSystemInfoContract>().ToList());
        }
예제 #6
0
        public void MoveItem_WherePathIsFileAndDestinationDirectoryIsDifferent_MovesFile()
        {
            var rootName           = FileSystemFixture.GetRootName();
            var rootDirectoryItems = fileSystemFixture.RootDirectoryItems;
            var subDirectoryItems  = fileSystemFixture.SubDirectoryItems;

            var original = (FileInfoContract)subDirectoryItems.Single(i => i.Name == "SubFile.ext");
            var moved    = default(FileInfoContract);

            var gatewayMock = mockingFixture.InitializeGetChildItems(rootName, @"\SubDir", rootDirectoryItems, subDirectoryItems);

            gatewayMock.Setup(g => g.MoveItem(rootName, new FileId(@"\File.ext"), @"FileMove.ext", new DirectoryId(@"\SubDir")))
            .Returns(moved = new FileInfoContract(original.Id.Value.Replace("File", "FileMove"), original.Name.Replace("File", "FileMove"), original.Created, original.Updated, original.Size, original.Hash))
            .Verifiable();
            compositionFixture.ExportGateway(gatewayMock.Object);

            var result = new PipelineFixture().Invoke(
                FileSystemFixture.NewDriveCommand,
                @"Move-Item -Path X:\File.ext -Destination X:\SubDir\FileMove.ext",
                @"Get-ChildItem -Path X:\SubDir"
                );

            Assert.AreEqual(subDirectoryItems.Count() + 1, result.Count, "Unexpected number of results");
            CollectionAssert.Contains(result.Select(p => p.BaseObject).ToArray(), moved, "Moved item is missing");

            gatewayMock.VerifyAll();
        }
예제 #7
0
        public void NewItemAsync_WherePathIsSubDirAndItemTypeIsDirectory_CreatesNewDirectory()
        {
            var rootName           = FileSystemFixture.GetRootName();
            var rootDirectoryItems = fileSystemFixture.RootDirectoryItems;
            var subDirectoryItems  = fileSystemFixture.SubDirectoryItems;
            var newItem            = new DirectoryInfoContract(@"\SubDir\NewSubSubDir", "NewSubSubDir", DateTime.Now, DateTime.Now);

            var gatewayMock = mockingFixture.InitializeGetChildItemsAsync(rootName, @"\SubDir", rootDirectoryItems, subDirectoryItems);

            gatewayMock.Setup(g => g.NewDirectoryItemAsync(rootName, new DirectoryId(@"\SubDir"), "NewSubSubDir"))
            .ReturnsAsync(newItem)
            .Verifiable();
            compositionFixture.ExportAsyncGateway(gatewayMock.Object);

            var result = new PipelineFixture().Invoke(
                FileSystemFixture.NewDriveCommand,
                @"New-Item -Type Directory -Path X:\SubDir -Name NewSubSubDir",
                @"Get-ChildItem -Path X:\SubDir"
                );

            Assert.AreEqual(subDirectoryItems.Length + 1, result.Count, "Unexpected number of results");
            CollectionAssert.Contains(result.Select(p => p.BaseObject).ToArray(), newItem, "Missing result");

            gatewayMock.VerifyAll();
        }
        public void CopyItemAsync_WherePathIsDirectoryAndDestinationDirectoryIsDifferent_CopiesDirectory()
        {
            var rootName           = FileSystemFixture.GetRootName();
            var rootDirectoryItems = fileSystemFixture.RootDirectoryItems;
            var subDirectoryItems  = fileSystemFixture.SubDirectoryItems;

            var original = (DirectoryInfoContract)rootDirectoryItems.Single(i => i.Name == "SubDir");
            var copy     = default(DirectoryInfoContract);

            var gatewayMock = mockingFixture.InitializeGetChildItemsAsync(rootName, @"\SubDir", rootDirectoryItems, subDirectoryItems);

            gatewayMock.Setup(g => g.CopyItemAsync(rootName, new DirectoryId(@"\SubDir"), @"SubDirCopy", new DirectoryId(@"\SubDir"), false))
            .ReturnsAsync(copy = new DirectoryInfoContract(original.Id.Value.Replace("SubDir", "SubDirCopy"), original.Name.Replace("SubDir", "SubDirCopy"), original.Created, original.Updated))
            .Verifiable();
            compositionFixture.ExportAsyncGateway(gatewayMock.Object);

            var result = new PipelineFixture().Invoke(
                FileSystemFixture.NewDriveCommand,
                @"Copy-Item -Path X:\SubDir -Destination X:\SubDir\SubDirCopy",
                @"Get-ChildItem -Path X:\SubDir"
                );

            Assert.AreEqual(subDirectoryItems.Count() + 1, result.Count, "Unexpected number of results");
            CollectionAssert.Contains(result.Select(p => p.BaseObject).ToArray(), copy, "Copied item is missing");

            gatewayMock.VerifyAll();
        }
예제 #9
0
        public void NewItemAsync_WherePathIsIncompleteAndItemTypeIsFile_CreatesNewFile()
        {
            var rootName                 = FileSystemFixture.GetRootName();
            var rootDirectoryItems       = fileSystemFixture.RootDirectoryItems;
            var newIntermediateDirectory = new DirectoryInfoContract(@"\NewSubDir", "NewSubDir", DateTime.Now, DateTime.Now);
            var newItem = new FileInfoContract(@"\NewSubDir\NewSubFile", "NewSubFile", DateTime.Now, DateTime.Now, 0, null);

            var gatewayMock = mockingFixture.InitializeGetChildItemsAsync(rootName, @"\", rootDirectoryItems);

            gatewayMock.Setup(g => g.NewDirectoryItemAsync(rootName, new DirectoryId(@"\"), "NewSubDir"))
            .ReturnsAsync(newIntermediateDirectory)
            .Verifiable();
            gatewayMock.Setup(g => g.NewFileItemAsync(rootName, new DirectoryId(@"\NewSubDir"), "NewSubFile", null, It.Is <IProgress <ProgressValue> >(p => true)))
            .ReturnsAsync(newItem)
            .Verifiable();
            var subDirs           = new Queue <string>(new[] { @"\", @"\NewSubDir" });
            var predicateIterator = new Func <string, bool>(s => s == subDirs.Dequeue());

            gatewayMock.SetupSequence(g => g.GetChildItemAsync(rootName, It.Is <DirectoryId>(d => predicateIterator(d.Value))))
            .ReturnsAsync(new FileSystemInfoContract[0])
            .ReturnsAsync(new FileSystemInfoContract[0])
            .ThrowsAsync(new InvalidOperationException(@"Redundant access to directory"));
            compositionFixture.ExportAsyncGateway(gatewayMock.Object);

            var result = new PipelineFixture().Invoke(
                FileSystemFixture.NewDriveCommand,
                @"New-Item -Type File -Path X:\NewSubDir -Name NewSubFile -Force",
                @"Get-ChildItem -Path X:\ -Filter 'NewSub*' -Recurse"
                );

            Assert.AreEqual(2, result.Count, "Unexpected number of results");
            CollectionAssert.AreEqual(result.Select(i => i.BaseObject).ToArray(), new FileSystemInfoContract[] { newIntermediateDirectory, newItem }, "Unexpected result");

            gatewayMock.VerifyAll();
        }
예제 #10
0
        public void NewItemAsync_WherePathIsSubDirAndItemTypeIsFile_CanRemoveNewFile()
        {
            var rootName           = FileSystemFixture.GetRootName();
            var rootDirectoryItems = fileSystemFixture.RootDirectoryItems;
            var subDirectoryItems  = fileSystemFixture.SubDirectoryItems;
            var newItem            = new FileInfoContract(@"\SubDir\NewSubFile", "NewSubFile", DateTime.Now, DateTime.Now, 0, null);

            var gatewayMock = mockingFixture.InitializeGetChildItemsAsync(rootName, @"\SubDir", rootDirectoryItems, subDirectoryItems);

            gatewayMock.Setup(g => g.NewFileItemAsync(rootName, new DirectoryId(@"\SubDir"), "NewSubFile", null, It.Is <IProgress <ProgressValue> >(p => true)))
            .ReturnsAsync(newItem)
            .Verifiable();
            gatewayMock.Setup(g => g.RemoveItemAsync(rootName, new FileId(@"\SubDir\NewSubFile"), false))
            .ReturnsAsync(true)
            .Verifiable();
            compositionFixture.ExportAsyncGateway(gatewayMock.Object);

            var result = new PipelineFixture().Invoke(
                FileSystemFixture.NewDriveCommand,
                @"New-Item -Type File -Path X:\SubDir -Name NewSubFile",
                @"Remove-Item -Path X:\SubDir\NewSubFile",
                @"Get-ChildItem -Path X:\SubDir"
                );

            Assert.AreEqual(subDirectoryItems.Length, result.Count, "Unexpected number of results");
            CollectionAssert.DoesNotContain(result.Select(p => p.BaseObject).ToArray(), newItem, "Excessive result");

            gatewayMock.VerifyAll();
        }
예제 #11
0
        public void ResolvePath_WhereBasePathIsRoot_CallsGatewayCorrectly()
        {
            var rootName           = FileSystemFixture.GetRootName();
            var rootDirectoryItems = fileSystemFixture.RootDirectoryItems;

            var gatewayMock = mockingFixture.InitializeGetChildItems(rootName, @"\", rootDirectoryItems);

            compositionFixture.ExportGateway(gatewayMock.Object);

            var result = new PipelineFixture().Invoke(new string[] {
                FileSystemFixture.NewDriveCommand,
                @"Resolve-Path X:\*"
            });

            Assert.AreEqual(rootDirectoryItems.Length, result.Count, "Unexpected number of results");
            CollectionAssert.AllItemsAreInstancesOfType(result.Select(i => i.BaseObject).ToList(), typeof(PathInfo), "Result is not of type PathInfo");
        }
        public void GetChildItemAsync_WherePathIsRoot_CallsGatewayCorrectly()
        {
            var rootName           = FileSystemFixture.GetRootName();
            var rootDirectoryItems = fileSystemFixture.RootDirectoryItems;

            var gatewayMock = mockingFixture.InitializeGetChildItemsAsync(rootName, @"\", rootDirectoryItems);

            compositionFixture.ExportAsyncGateway(gatewayMock.Object);

            var result = new PipelineFixture().Invoke(
                FileSystemFixture.NewDriveCommand,
                @"Get-ChildItem -Path X:\"
                );

            Assert.AreEqual(rootDirectoryItems.Length, result.Count, "Unexpected number of results");
            CollectionAssert.AreEquivalent(rootDirectoryItems, result.Select(p => p.BaseObject).Cast <FileSystemInfoContract>().ToList());
        }
        public void GetChildItemAsync_WherePathIsRootAndFilterIsSpecified_CallsGatewayCorrectly()
        {
            var rootName           = FileSystemFixture.GetRootName();
            var rootDirectoryItems = fileSystemFixture.RootDirectoryItems;

            var gatewayMock = mockingFixture.InitializeGetChildItemsAsyncWithFilter(rootName, @"\", "*File.ext", rootDirectoryItems);

            compositionFixture.ExportAsyncGateway(gatewayMock.Object);

            var result = new PipelineFixture().Invoke(
                FileSystemFixture.NewDriveCommand,
                @"Get-ChildItem -Path X:\ -Filter *File.ext"
                );

            Assert.AreEqual(rootDirectoryItems.Count(i => i.Name.EndsWith("File.ext", StringComparison.Ordinal)), result.Count, "Unexpected number of results");
            CollectionAssert.AllItemsAreInstancesOfType(result.Select(i => i.BaseObject).ToList(), typeof(FileInfoContract), "Results are not of type FileInfoContract");
            CollectionAssert.AreEqual(rootDirectoryItems.Where(i => i.Name.EndsWith("File.ext", StringComparison.Ordinal)).ToList(), result.Select(i => i.BaseObject).ToList(), "Mismatched result");
        }
예제 #14
0
        public void ResolvePath_WhereBasePathIsSubDirectoryAndPatternContainsPrefix_CallsGatewayCorrectly()
        {
            var rootName           = FileSystemFixture.GetRootName();
            var rootDirectoryItems = fileSystemFixture.RootDirectoryItems;
            var subDirectoryItems  = fileSystemFixture.SubDirectoryItems;

            var gatewayMock = mockingFixture.InitializeGetChildItems(rootName, @"\SubDir", rootDirectoryItems, subDirectoryItems);

            compositionFixture.ExportGateway(gatewayMock.Object);

            var result = new PipelineFixture().Invoke(new string[] {
                FileSystemFixture.NewDriveCommand,
                @"Resolve-Path X:\SubDir\Sub*"
            });

            Assert.AreEqual(subDirectoryItems.Count(i => i.Name.StartsWith("Sub", StringComparison.Ordinal)), result.Count, "Unexpected number of results");
            CollectionAssert.AllItemsAreInstancesOfType(result.Select(i => i.BaseObject).ToList(), typeof(PathInfo), "Result is not of type PathInfo");
            CollectionAssert.AreEqual(subDirectoryItems.Where(i => i.Name.StartsWith("Sub", StringComparison.Ordinal)).Select(i => @"X:" + i.Id).ToList(), result.Select(i => ((PathInfo)i.BaseObject).Path).ToList());
        }
예제 #15
0
        public void GetContentAsync_WhereNodeIsFileAndEncodingIsByte_ReturnsContent()
        {
            var rootName           = FileSystemFixture.GetRootName();
            var rootDirectoryItems = fileSystemFixture.RootDirectoryItems;
            var content            = new MemoryStream(TestContent.MultiLineTestContent.Select(c => Convert.ToByte(c)).ToArray());

            var gatewayMock = mockingFixture.InitializeGetChildItemsAsync(rootName, @"\", rootDirectoryItems);

            gatewayMock.SetupSequence(g => g.GetContentAsync(rootName, new FileId(@"\File.ext")))
            .ReturnsAsync(content)
            .ThrowsAsync(new InvalidOperationException(@"Redundant access to \File.ext"));
            compositionFixture.ExportAsyncGateway(gatewayMock.Object);

            var result = new PipelineFixture().Invoke(
                FileSystemFixture.NewDriveCommand,
                @"Get-Content -Path X:\File.ext -Encoding Byte"
                );

            CollectionAssert.AreEqual(content.ToArray(), result.Select(p => p.BaseObject).ToArray(), "Mismatching content");
        }
예제 #16
0
        public void NewItem_WherePathIsRootAndItemTypeIsFile_CreatesNewFile()
        {
            var rootName           = FileSystemFixture.GetRootName();
            var rootDirectoryItems = fileSystemFixture.RootDirectoryItems;
            var newItem            = new FileInfoContract(@"\NewFile", "NewFile", DateTime.Now, DateTime.Now, 0, null);

            var gatewayMock = mockingFixture.InitializeGetChildItems(rootName, @"\", rootDirectoryItems);

            gatewayMock.Setup(g => g.NewFileItem(rootName, new DirectoryId(@"\"), "NewFile", null, It.Is <IProgress <ProgressValue> >(p => true)))
            .Returns(newItem)
            .Verifiable();
            compositionFixture.ExportGateway(gatewayMock.Object);

            var result = new PipelineFixture().Invoke(
                FileSystemFixture.NewDriveCommand,
                @"New-Item -Type File -Path X:\ -Name NewFile",
                @"Get-ChildItem -Path X:\"
                );

            Assert.AreEqual(rootDirectoryItems.Length + 1, result.Count, "Unexpected number of results");
            CollectionAssert.Contains(result.Select(p => p.BaseObject).ToArray(), newItem, "Missing result");

            gatewayMock.VerifyAll();
        }
        public void RemoveItemAsync_WherePathIsFile_RemovesFile()
        {
            var rootName           = FileSystemFixture.GetRootName();
            var rootDirectoryItems = fileSystemFixture.RootDirectoryItems;

            var gatewayMock = mockingFixture.InitializeGetChildItemsAsync(rootName, @"\", rootDirectoryItems);

            gatewayMock.Setup(g => g.RemoveItemAsync(rootName, new FileId(@"\File.ext"), false))
            .ReturnsAsync(true)
            .Verifiable();
            compositionFixture.ExportAsyncGateway(gatewayMock.Object);

            var result = new PipelineFixture().Invoke(
                FileSystemFixture.NewDriveCommand,
                @"Remove-Item -Path X:\File.ext",
                @"Get-ChildItem -Path X:\"
                );

            Assert.AreEqual(rootDirectoryItems.Length - 1, result.Count, "Unexpected number of results");
            CollectionAssert.AreEquivalent(rootDirectoryItems.Where(f => f.Name != "File.ext").ToList(), result.Select(p => p.BaseObject).Cast <FileSystemInfoContract>().ToList());

            gatewayMock.VerifyAll();
        }
        public void GetChildItemAsync_WherePathIsRootAndExcludeIsSpecified_CallsGatewayCorrectly()
        {
            var rootName             = FileSystemFixture.GetRootName();
            var rootDirectoryItems   = fileSystemFixture.RootDirectoryItems;
            var subDirectoryItems    = fileSystemFixture.SubDirectoryItems;
            var subSubDirectoryItems = fileSystemFixture.SubSubDirectoryItems;

            var gatewayMock = mockingFixture.InitializeGetChildItemsAsync(rootName, @"\SubDir\SubSubDir", rootDirectoryItems, subDirectoryItems, subSubDirectoryItems);

            compositionFixture.ExportAsyncGateway(gatewayMock.Object);

            var result = new PipelineFixture().Invoke(
                FileSystemFixture.NewDriveCommand,
                @"Get-ChildItem -Path X:\ -Exclude *File.ext"
                );

            Assert.AreEqual(2, result.Count, "Unexpected number of results");
            CollectionAssert.AreEquivalent(rootDirectoryItems.Where(i => !i.Name.EndsWith("File.ext", StringComparison.Ordinal)).ToList(), result.Select(i => i.BaseObject).ToList(), "Mismatched result");
        }