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());
        }
 public void Cleanup()
 {
     mockingFixture     = null;
     compositionFixture = null;
     fileSystemFixture  = null;
 }
 public void Initialize()
 {
     fileSystemFixture  = new FileSystemFixture();
     compositionFixture = new CompositionFixture();
     mockingFixture     = new MockingFixture();
 }