public void StatusAfterConnectIsConnected() { IFolderStats folderStats = new FolderStatsMock(fileSystem); folderStats.Connect(RootPath); Assert.AreEqual(Statuses.Connected, folderStats.Status); }
public void EmptyDirectory_StartReturns1() { var root = GivenDirectory("c:\temp\test001"); IFolderStats folderStats = new FolderStatsMock(fileSystem); StartAndWait(folderStats, root, 10); Assert.AreEqual(1, folderStats.Folders.Count()); }
public void StatusCompleted_WhenPauseCalled_ExceptionThrown() { var root = GivenDirectory("c:\temp\test001"); IFolderStats folderStats = new FolderStatsMock(fileSystem); StartAndWait(folderStats, root, 10); folderStats.Pause(); }
public void OneFile_Returns1File() { var root = GivenDirectory("c:\temp\test001"); root.Files.Add(new FileMock()); IFolderStats folderStats = new FolderStatsMock(fileSystem); StartAndWait(folderStats, root, 10); Assert.AreEqual(1, folderStats.Folders.First().NumberOfFiles); }
public void OneSubDirectory_StartReturns2() { var root = GivenDirectory("c:\temp\test001"); root.SubDirectories.Add(new DirectoryMock("1")); IFolderStats folderStats = new FolderStatsMock(fileSystem); StartAndWait(folderStats, root, 10); Assert.AreEqual(2, folderStats.Folders.Count()); }
public void DirectoryWith2Subfolders_WhenPauseCalled_StatusPaused() { var root = GivenDirectory("c:\temp\test001"); root.SubDirectories.Add(new DirectoryMock("1")); root.SubDirectories.Add(new DirectoryMock("2")); IFolderStats folderStats = new FolderStatsMock(fileSystem); folderStats.Progress += folder => { Thread.Sleep(100); }; folderStats.Connect(root.Name); folderStats.Start(); folderStats.Pause(); Assert.AreEqual(Statuses.Paused, folderStats.Status); }
public void EmptyDirectory_RaisesProgress() { var root = GivenDirectory("c:\temp\test001"); IFolderStats folderStats = new FolderStatsMock(fileSystem); var counter = 0; var resetEvent = new AutoResetEvent(false); folderStats.Progress += folder => { counter++; resetEvent.Set(); }; folderStats.Connect(root.Name); folderStats.Start(); resetEvent.WaitOne(1000); Assert.AreEqual(1, counter); }
public void InitialStatusWaiting() { IFolderStats folderStats = new FolderStatsMock(fileSystem); Assert.AreEqual(Statuses.Waiting, folderStats.Status); }