当前位置: 首页>>代码示例>>C#>>正文


C# TemporaryFolder.Combine方法代码示例

本文整理汇总了C#中Palaso.TestUtilities.TemporaryFolder.Combine方法的典型用法代码示例。如果您正苦于以下问题:C# TemporaryFolder.Combine方法的具体用法?C# TemporaryFolder.Combine怎么用?C# TemporaryFolder.Combine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Palaso.TestUtilities.TemporaryFolder的用法示例。


在下文中一共展示了TemporaryFolder.Combine方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LaunchDialog_CustomUrlSourceWontBeFound

 public void LaunchDialog_CustomUrlSourceWontBeFound()
 {
     using (var source = new TemporaryFolder("CloneDialogTest"))
     {
         Directory.CreateDirectory(source.Combine("repo1"));
         HgRepository.CreateRepositoryInExistingDir(source.Combine("repo1"), new NullProgress());
         LaunchCustomUrl(@"somewhereElse");
     }
 }
开发者ID:sillsdev,项目名称:chack,代码行数:9,代码来源:GetCloneFromInternetDialogTests.cs

示例2: GetDirectoriesWithMecurialRepos_OneDriveOneRepo_ReturnsRepoPath

 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());
     }
 }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:14,代码来源:ClonerTests.cs

示例3: GetDirectoriesWithMecurialRepos_TwoRepos_ReturnsOnlyUnfilteredPath

 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());
     }
 }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:16,代码来源:ClonerTests.cs

示例4: TempLiftFile

		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);
		}
开发者ID:JohnThomson,项目名称:libpalaso,代码行数:8,代码来源:TemporaryFolder.cs

示例5: Clone_Test

 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")));
     }
 }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:9,代码来源:ProxyTests.cs

示例6: Pull_Test

 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")));
     }
 }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:11,代码来源:ProxyTests.cs

示例7: GetDirectoriesWithMecurialRepos_OneDriveAndDirectoryButNotRep_ReturnsEmptyList

 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());
     }
 }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:12,代码来源:ClonerTests.cs

示例8: LaunchDialog_SimulatedUsb_ProjectAlreadyExists

        public void LaunchDialog_SimulatedUsb_ProjectAlreadyExists()
        {
            using (var targetComputer = new TemporaryFolder("clonetest-targetComputer"))
            using (var usb = new TemporaryFolder("clonetest-Usb"))
            {
                Directory.CreateDirectory(usb.Combine("repo1"));
                HgRepository.CreateRepositoryInExistingDir(usb.Combine("repo1"), new NullProgress());

                //ok, the point here is that we already haved something called "repo1"
                Directory.CreateDirectory(targetComputer.Combine("repo1"));

                using (var dlg = new GetCloneFromUsbDialog(targetComputer.Path))
                {
                    var drives = new List<IUsbDriveInfo>();
                    drives.Add(new UsbDriveInfoForTests(usb.Path));

                    //don't look at the actual drives, look at our simulations
                    dlg.Model.DriveInfoRetriever = new RetrieveUsbDriveInfoForTests(drives);

                    if (DialogResult.OK != dlg.ShowDialog())
                        return;
                }
            }
        }
开发者ID:sillsdev,项目名称:chack,代码行数:24,代码来源:GetCloneFromUsbDialogTests.cs

示例9: PullThenPush_Test

        public void PullThenPush_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")));

                //nb: this is safe to do over an over, because it will just say "no changes found", never actually add a changeset

                repo.Push(address, _cloneableTestProjectUrl);
            }
        }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:15,代码来源:ProxyTests.cs

示例10: ChangePicture_PictureIsFromOutsideProject_PictureCopiedAndAttributeChanged

 public void ChangePicture_PictureIsFromOutsideProject_PictureCopiedAndAttributeChanged()
 {
     var dom = new XmlDocument();
     dom.LoadXml("<html><body><div/><div><img id='one'/><img id='two' src='old.png'/></div></body></html>");
     var model = new PageEditingModel();
     using (var src = new TemporaryFolder("bloom pictures test source"))
     using (var dest = new TemporaryFolder("bloom picture tests dest"))
     {
         var newImagePath = src.Combine("new.png");
         using (var original = MakeSamplePngImage(newImagePath))
         {
             model.ChangePicture(dest.Path, dom, "two", original);
             Assert.IsTrue(File.Exists(dest.Combine("new.png")));
             AssertThatXmlIn.Dom(dom).HasSpecifiedNumberOfMatchesForXpath(@"//img[@id='two' and @src='new.png']", 1);
         }
     }
 }
开发者ID:JohnThomson,项目名称:testBloom,代码行数:17,代码来源:PageEditingModelTests.cs

示例11: ChangePicture_AlreadyHaveACopyInPublicationFolder_PictureUpdated

 public void ChangePicture_AlreadyHaveACopyInPublicationFolder_PictureUpdated()
 {
     var dom = new XmlDocument();
     dom.LoadXml("<html><body><div/><div><img id='one'/><img id='two' src='old.png'/></div></body></html>");
     var model = new PageEditingModel();
     using (var src = new TemporaryFolder("bloom pictures test source"))
     using (var dest = new TemporaryFolder("bloom picture tests dest"))
     {
         var dogImagePath = src.Combine("dog.png");
         using (var original = MakeSamplePngImage(dogImagePath))
         {
             var destDogImagePath = dest.Combine("dog.png");
             File.WriteAllText(destDogImagePath, "old dog");
             model.ChangePicture(dest.Path, dom, "two", original);
             Assert.IsTrue(Image.FromFile(destDogImagePath).Width == kSampleImageDimension);
         }
     }
 }
开发者ID:JohnThomson,项目名称:testBloom,代码行数:18,代码来源:PageEditingModelTests.cs

示例12: ChangePicture_PictureIsJpg_StaysJpg

 public void ChangePicture_PictureIsJpg_StaysJpg()
 {
     var dom = new XmlDocument();
     dom.LoadXml("<html><body><div/><div><img id='one'/><img id='two' src='old.png'/></div></body></html>");
     var model = new PageEditingModel();
     using (var src = new TemporaryFolder("bloom pictures test source"))
     using (var dest = new TemporaryFolder("bloom picture tests dest"))
     using (var original = MakeSampleJpegImage(src.Combine("new.jpg")))
     {
         model.ChangePicture(dest.Path, dom, "two", original);
         Assert.IsTrue(File.Exists(dest.Combine("new.jpg")));
         AssertThatXmlIn.Dom(dom).HasSpecifiedNumberOfMatchesForXpath(@"//img[@id='two' and @src='new.jpg']", 1);
         using (var converted = Image.FromFile(dest.Combine("new.jpg")))
         {
             Assert.AreEqual(ImageFormat.Jpeg.Guid, converted.RawFormat.Guid);
         }
     }
 }
开发者ID:JohnThomson,项目名称:testBloom,代码行数:18,代码来源:PageEditingModelTests.cs

示例13: EnsureTheseExtensionAreEnabled_someOthersEnabledAlready_StayEnabled

        public void EnsureTheseExtensionAreEnabled_someOthersEnabledAlready_StayEnabled()
        {
            using (new MercurialIniForTests())
            using (var testRoot = new TemporaryFolder("ChorusHgSettingsTest"))
            {
                HgRepository.CreateRepositoryInExistingDir(testRoot.Path, _progress);
                var repository = new HgRepository(testRoot.Path, new ConsoleProgress());
                File.WriteAllText(testRoot.Combine(Path.Combine(".hg", "hgrc")), @"
            [extensions]
            a =
            x =
            ");
                var extensions = new Dictionary<string, string>();
                extensions.Add("a", "");
                extensions.Add("b", "");
                repository.EnsureTheseExtensionsAndFormatSet(extensions);

                Assert.AreEqual(3, repository.GetEnabledExtension().Count());
                Assert.AreEqual("a", repository.GetEnabledExtension().ToArray()[0]);
                Assert.AreEqual("x", repository.GetEnabledExtension().ToArray()[1]);
                Assert.AreEqual("b", repository.GetEnabledExtension().ToArray()[2]);
            }
        }
开发者ID:sillsdev,项目名称:chack,代码行数:23,代码来源:HgSettingsTests.cs

示例14: GetFilesInRevision_MultipleRevisionsInRepo_GivesCorrectFiles

        public void GetFilesInRevision_MultipleRevisionsInRepo_GivesCorrectFiles()
        {
            using (var testRoot = new TemporaryFolder("ChorusRetrieveTest"))
            {
                var temp = testRoot.Combine("filename with spaces");
                File.WriteAllText(temp, "one");
                using (var f = TempFile.TrackExisting(temp))
                {
                    HgRepository.CreateRepositoryInExistingDir(testRoot.Path,_progress);
                    var repo = new HgRepository(testRoot.Path, _progress);

                    repo.AddAndCheckinFile(f.Path);
                    repo.Commit(true, "initial");
                    File.WriteAllText(f.Path, "one two");
                    repo.Commit(true, "second");

                    var revisions = repo.GetAllRevisions();
                    Assert.AreEqual(2, revisions.Count);
                    var files = repo.GetFilesInRevision(revisions[0]);
                    Assert.AreEqual(1, files.Count());
                    Assert.AreEqual(f.Path, files.First().FullPath);
                }
            }
        }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:24,代码来源:FileInRevisionTests.cs

示例15: GetIsReady

        private bool GetIsReady(string pathsSectionContents)
        {
            string contents = @"[paths]" + Environment.NewLine + pathsSectionContents+Environment.NewLine;

            using (var testRoot = new TemporaryFolder("ChorusHgSettingsTest"))
            {
                HgRepository.CreateRepositoryInExistingDir(testRoot.Path, _progress);
                File.WriteAllText(testRoot.Combine(Path.Combine(".hg", "hgrc")), contents);
                var repo = new HgRepository(testRoot.Path, _progress);
                string msg;
                bool ready= repo.GetIsReadyForInternetSendReceive(out msg);
                Console.WriteLine(msg);
                return ready;
            }
        }
开发者ID:sillsdev,项目名称:chack,代码行数:15,代码来源:HgSettingsTests.cs


注:本文中的Palaso.TestUtilities.TemporaryFolder.Combine方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。