Пример #1
0
		public void Constructor_CreatesTemporarySubDirectory()
		{
			var temporaryFolder = new TemporaryFolder();
			Assert.IsTrue(Directory.Exists(temporaryFolder.FolderPath));
			temporaryFolder.Dispose();
			Assert.IsFalse(Directory.Exists(temporaryFolder.Path));
		}
Пример #2
0
 public HgTestSetup()
 {
     _progress = new ConsoleProgress();
     Root = new TemporaryFolder("ChorusHgWrappingTest");
     HgRepository.CreateRepositoryInExistingDir(Root.Path,_progress);
     Repository = new HgRepository(Root.Path, new NullProgress());
 }
Пример #3
0
		public void Constructor_Path_CreatesTemporarySubDirectoryAtPath()
		{
			using (TemporaryFolder temporaryFolder = new TemporaryFolder("foo"))
			{
				Assert.IsTrue(Directory.Exists(temporaryFolder.FolderPath));
			}
		}
		public void Setup()
		{
			_temporaryFolder = new TemporaryFolder();
			string filePath = _temporaryFolder.GetTemporaryFile();
			_repository = new LiftLexEntryRepository(filePath);
			_headwordWritingSystem = new WritingSystemDefinition("th");
		}
Пример #5
0
		public void Constructor_PathDirectoryName_CreatesTemporarySubDirectoryAtPathWithGivenName()
		{
			TemporaryFolder temporaryFolder = new TemporaryFolder("Constructor_PathDirectoryName_CreatesTemporarySubDirectoryAtPathWithGivenName");
			Assert.IsTrue(Directory.Exists(temporaryFolder.FolderPath));
			temporaryFolder.Dispose();
			Assert.IsFalse(Directory.Exists(temporaryFolder.Path));
		}
		public void Setup()
		{
			ErrorReport.IsOkToInteractWithUser = false;
			_tmpFolder = new TemporaryFolder("IMDIArchiveHelperTestFolder");
			_model = new IMDIArchivingDlgViewModel(kAppName, kTitle, kArchiveId, null, true,
				SetFilesToArchive, _tmpFolder.Path);
		}
Пример #7
0
 public RepositorySetup(string userName, string projectfolder)
 {
     Progress = new NullProgress();
     ProjectFolder = new TemporaryFolder(projectfolder);
     MakeRepositoryForTest(ProjectFolder.Path, userName, Progress);
     ProjectFolderConfig = new ProjectFolderConfiguration(ProjectFolder.Path);
 }
		public void Constructor_CreatesFolders()
		{
			using (var e = new TemporaryFolder("GlobalWritingSystemRepositoryTests"))
			{
				var repo = new GlobalWritingSystemRepository(e.Path);
				Assert.That(Directory.Exists(repo.PathToWritingSystems), Is.True);
			}
		}
		public void PathConstructor_HasCorrectPath()
		{
			using (var e = new TemporaryFolder("GlobalWritingSystemRepositoryTests"))
			{
				var repo = new GlobalWritingSystemRepository(e.Path);
				Assert.That(repo.PathToWritingSystems, Is.StringMatching(".*GlobalWritingSystemRepositoryTests.2"));
			}
		}
Пример #10
0
 public void Launch_CloseAfterAFewSeconds_DoesntCrash()
 {
     using (var folder = new TemporaryFolder("ChorusApplicationTests"))
     {
         Application.Idle += new EventHandler(Application_Idle);
         new Program.Runner().Run(folder.Path, new Arguments(new object[]{}));
     }
 }
Пример #11
0
		public TempLiftFile(string fileName, TemporaryFolder parentFolder, string xmlOfEntries, string claimedLiftVersion)
			: base(true) // True means "I'll set the the pathname, thank you very much." Otherwise, the temp one 'false' creates will stay forever, and fill the hard drive up.
		{
			_path = parentFolder.Combine(fileName);

			string liftContents = string.Format("<?xml version='1.0' encoding='utf-8'?><lift version='{0}'>{1}</lift>", claimedLiftVersion, xmlOfEntries);
			File.WriteAllText(_path, liftContents);
		}
			public TestEnvironment(string liftFileContent)
			{
				_folder = new TemporaryFolder("WritingSystemsInLiftFileHelper");
				var pathtoLiftFile1 = Path.Combine(_folder.Path, "test1.lift");
				_liftFile1 = new IO.TempFile(liftFileContent);
				_liftFile1.MoveTo(pathtoLiftFile1);
				Helper = new WritingSystemsInLiftFileHelper(WritingSystems, _liftFile1.Path);
			}
Пример #13
0
		public void GetTemporaryFile_FileExistsInTemporarySubdirectory()
		{
			TemporaryFolder temporaryFolder = new TemporaryFolder();
			string pathToFile = temporaryFolder.GetTemporaryFile();
			Assert.IsTrue(File.Exists(pathToFile));
			temporaryFolder.Dispose();
			Assert.IsFalse(Directory.Exists(temporaryFolder.Path));
		}
        [Test]//regression
        public void RepoProjectName_SourceHasDotInName_IsNotLost()
        {
			using (var f = new TemporaryFolder("SourceHasDotInName_IsNotLost.x.y"))
            {
                Synchronizer m = new Synchronizer(f.Path, new ProjectFolderConfiguration("blah"), new ConsoleProgress());

                Assert.AreEqual("SourceHasDotInName_IsNotLost.x.y", m.RepoProjectName);
            }
        }
Пример #15
0
 public void HasNoExtantRepositories()
 {
     using (var hasProject = new TemporaryFolder("hasRepo"))
     {
         var newFile = Path.Combine(hasProject.Path, "test.txt");
         File.WriteAllText(newFile, "some stuff");
         Assert.AreEqual(0, GetSharedProjectModel.ExtantRepoIdentifiers(hasProject.Path, null).Count);
     }
 }
 public void LaunchDialog_CustomUrlSourceWontBeFound()
 {
     using (var source = new TemporaryFolder("CloneDialogTest"))
     {
         Directory.CreateDirectory(source.Combine("repo1"));
         HgRepository.CreateRepositoryInExistingDir(source.Combine("repo1"), new NullProgress());
         LaunchCustomUrl(@"somewhereElse");
     }
 }
Пример #17
0
		public void GetTemporaryFile_CalledTwice_BothFilesFoundInSameTemporarySubdirectory()
		{
			TemporaryFolder temporaryFolder = new TemporaryFolder();
			temporaryFolder.GetTemporaryFile();
			temporaryFolder.GetTemporaryFile();
			Assert.AreEqual(2, Directory.GetFiles(temporaryFolder.Path).Length);
			temporaryFolder.Dispose();
			Assert.IsFalse(Directory.Exists(temporaryFolder.Path));
		}
		public void Setup()
		{
			// The contents of the properties file that we create here doesn't really matter
			// for these tests, so we simply pass bogus content
			_sueRepo = new RepositoryWithFilesSetup("Sue",
				SharedConstants.CustomPropertiesFilename, "contents");

			_tempDir = new TemporaryFolder(Guid.NewGuid().ToString());
		}
		public void Constructor_WithExistingFolders_NoThrow()
		{
			using (var e = new TemporaryFolder("GlobalWritingSystemRepositoryTests"))
			{
				new GlobalWritingSystemRepository(e.Path);
				var repo2 = new GlobalWritingSystemRepository(e.Path);
				Assert.That(Directory.Exists(repo2.PathToWritingSystems), Is.True);
			}
		}
Пример #20
0
 public void SetBookName_EasyCase_ChangesFolderAndFileName()
 {
     var storage = GetInitialStorage();
        using (var newFolder = new TemporaryFolder(_fixtureFolder,"newName"))
        {
        Directory.Delete(newFolder.Path);
        ChangeNameAndCheck(newFolder, storage);
        }
 }
Пример #21
0
 public void SetBookName_FolderNameWasDifferentThanFileName_ChangesFolderAndFileName()
 {
     var storage = GetInitialStorageWithDifferentFileName("foo");
     using (var newFolder = new TemporaryFolder(_fixtureFolder,"newName"))
     {
         Directory.Delete(newFolder.Path);
         ChangeNameAndCheck(newFolder, storage);
     }
 }
Пример #22
0
        public void Setup()
        {
            Palaso.Reporting.ErrorReport.IsOkToInteractWithUser = false;
            _folder  =new TemporaryFolder("BookCollectionTests");
            //			_fileLocator = new BloomFileLocator(new CollectionSettings(), new XMatterPackFinder(new string[]{}), new string[] { FileLocator.GetDirectoryDistributedWithApplication("root"), FileLocator.GetDirectoryDistributedWithApplication("factoryCollections") });
            _fileLocator = new FileLocator(new string[] { FileLocator.GetDirectoryDistributedWithApplication("BloomBrowserUI"), FileLocator.GetDirectoryDistributedWithApplication("browserui/bookCss"), FileLocator.GetDirectoryDistributedWithApplication("factoryCollections") });

            _collection = new BookCollection(_folder.Path, BookCollection.CollectionType.TheOneEditableCollection, new BookSelection());
        }
Пример #23
0
		public void GetTemporaryFile_Name_FileWithNameExistsInTemporarySubdirectory()
		{
			TemporaryFolder temporaryFolder = new TemporaryFolder();
			string pathToFile = temporaryFolder.GetTemporaryFile("blah");
			Assert.IsTrue(File.Exists(pathToFile));
			Assert.AreEqual(pathToFile, Path.Combine(temporaryFolder.Path, "blah"));
			temporaryFolder.Dispose();
			Assert.IsFalse(Directory.Exists(temporaryFolder.Path));
		}
Пример #24
0
 public void Clone_Test()
 {
     // RobustNetworkOperation.ClearCredentialSettings();
     using (var f = new TemporaryFolder("clonetest"))
     {
         HgRepository.Clone(new HttpRepositoryPath("cloneableTestProjectUrl", _cloneableTestProjectUrl, false), f.Path, _progress);
         Assert.IsTrue(Directory.Exists(f.Combine(f.Path, ".hg")));
     }
 }
 public void FixtureSetUp()
 {
     LanguageForgeFolder = new TemporaryFolder("FdoTestFixture");
     _env = new TestEnvironment(
         resetLfProjectsDuringCleanup: false,
         languageForgeServerFolder: LanguageForgeFolder,
         registerLfProxyMock: false
     );
 }
Пример #26
0
 public void BadMercurialIni_Throws()
 {
     using (new MercurialIniHider())
     using (var testRoot = new TemporaryFolder("ChorusHgSettingsTest"))
     {
         Assert.Throws<ApplicationException>(() =>
             HgRepository.CreateRepositoryInExistingDir(testRoot.Path, _progress)
         );
     }
 }
Пример #27
0
 public void Pull_Test()
 {
     //RobustNetworkOperation.ClearCredentialSettings();
     using (var f = new TemporaryFolder("pulltest"))
     {
         var repo = HgRepository.CreateOrUseExisting(f.Path, _progress);
         var address = new HttpRepositoryPath("default", _cloneableTestProjectUrl, false);
         repo.Pull(address, _cloneableTestProjectUrl);
         Assert.IsTrue(Directory.Exists(f.Combine(f.Path, ".hg")));
     }
 }
 public void InitFromUri_GivenCompleteUri_AllPropertiesCorrect()
 {
     using (var testFolder = new TemporaryFolder("clonetest"))
     {
         var model = new GetCloneFromInternetModel(testFolder.Path);
         model.InitFromUri("http://*****:*****@hg-languagedepot.org/tpi?localFolder=tokPisin");
         Assert.AreEqual("tokPisin", model.LocalFolderName);
         Assert.IsTrue(model.ReadyToDownload);
         Assert.AreEqual("http://*****:*****@hg-languagedepot.org/tpi",model.URL);
     }
 }
Пример #29
0
        public void CreateOrLocate_FolderHasAccentedLetter2_FindsIt()
        {
            using (var testRoot = new TemporaryFolder("bloom sr test"))
            {
                string path = Path.Combine(testRoot.Path, "Abé Books");
                Directory.CreateDirectory(path);

                Assert.NotNull(HgRepository.CreateOrUseExisting(path, new ConsoleProgress()));
                Assert.NotNull(HgRepository.CreateOrUseExisting(path, new ConsoleProgress()));
            }
        }
 public void URL_AfterConstruction_GoodDefault()
 {
     using (var testFolder = new TemporaryFolder("clonetest"))
     {
         var model = new GetCloneFromInternetModel(testFolder.Path);
         model.AccountName = "account";
         model.Password = "******";
         model.ProjectId = "id";
         Assert.AreEqual("http://*****:*****@resumable.languagedepot.org/id", model.URL.ToLower());
     }
 }