public void GetDirectoriesWithMecurialRepos_OneDriveOneRepo_ReturnsRepoPath() { using (var usb = new TemporaryFolder("clonetestUsb")) { Directory.CreateDirectory(usb.Combine("test")); Directory.CreateDirectory(usb.Combine("testrepo", ".hg")); var model = new CloneFromUsb(); var drives = new List <IUsbDriveInfo>(); drives.Add(new UsbDriveInfoForTests(usb.Path)); model.DriveInfoRetriever = new RetrieveUsbDriveInfoForTests(drives); Assert.AreEqual(1, model.GetDirectoriesWithMecurialRepos().Count()); Assert.AreEqual(usb.Combine("testrepo"), model.GetDirectoriesWithMecurialRepos().First()); } }
public void GetDirectoriesWithMecurialRepos_NoDrivesFound_ReturnsEmptyList() { var model = new CloneFromUsb(); var drives = new List <IUsbDriveInfo>(); model.DriveInfoRetriever = new RetrieveUsbDriveInfoForTests(drives); Assert.AreEqual(0, model.GetDirectoriesWithMecurialRepos().Count()); }
public void GetDirectoriesWithMecurialRepos_OneDriveAndDirectoryButNotRep_ReturnsEmptyList() { using (var usb = new TemporaryFolder("clonetestUsb")) { Directory.CreateDirectory(usb.Combine("tests")); var model = new CloneFromUsb(); var drives = new List <IUsbDriveInfo>(); drives.Add(new UsbDriveInfoForTests(usb.Path)); model.DriveInfoRetriever = new RetrieveUsbDriveInfoForTests(drives); Assert.AreEqual(0, model.GetDirectoriesWithMecurialRepos().Count()); } }
public void GetDirectoriesWithMecurialRepos_WithRepo2DeepIsNotFound() { using (var usb1 = new TemporaryFolder("clonetestUsb1")) { Directory.CreateDirectory(usb1.Combine("a", "repo1", ".hg")); var model = new CloneFromUsb(); var drives = new List <IUsbDriveInfo>(); drives.Add(new UsbDriveInfoForTests(usb1.Path)); model.DriveInfoRetriever = new RetrieveUsbDriveInfoForTests(drives); Assert.AreEqual(0, model.GetDirectoriesWithMecurialRepos().Count()); } }
public void GetDirectoriesWithMecurialRepos_TwoRepos_ReturnsOnlyUnfilteredPath() { using (var usb = new TemporaryFolder("clonetestUsb")) { Directory.CreateDirectory(usb.Combine("test1")); Directory.CreateDirectory(usb.Combine("test1", ".hg")); Directory.CreateDirectory(usb.Combine("testSKIP")); Directory.CreateDirectory(usb.Combine("testSKIP", ".hg")); var model = new CloneFromUsb(); var drives = new List <IUsbDriveInfo>(); drives.Add(new UsbDriveInfoForTests(usb.Path)); model.DriveInfoRetriever = new RetrieveUsbDriveInfoForTests(drives); model.ProjectFilter = path => !path.Contains("SKIP"); Assert.AreEqual(1, model.GetDirectoriesWithMecurialRepos().Count()); } }