本文整理汇总了C#中SIL.TestUtilities.TemporaryFolder.Combine方法的典型用法代码示例。如果您正苦于以下问题:C# TemporaryFolder.Combine方法的具体用法?C# TemporaryFolder.Combine怎么用?C# TemporaryFolder.Combine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SIL.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");
}
}
示例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());
}
}
示例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());
}
}
示例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);
}
示例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")));
}
}
示例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")));
}
}
示例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());
}
}
示例8: 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);
}
}
示例9: FileInfo
public static void ProcessAndSaveImageIntoFolder_SimpleImageHasTransparentBackground_ImageNotConvertedAndFileSizeNotIncreased()
{
var inputPath = SIL.IO.FileLocator.GetFileDistributedWithApplication(_pathToTestImages, "shirtWithTransparentBg.png");
var originalFileSize = new FileInfo(inputPath).Length;
using (var image = PalasoImage.FromFileRobustly(inputPath))
{
using (var folder = new TemporaryFolder("TransparentPngTest"))
{
var fileName = ImageUtils.ProcessAndSaveImageIntoFolder(image, folder.Path, false);
Assert.AreEqual(".png", Path.GetExtension(fileName));
var outputPath = folder.Combine(fileName);
using (var result = Image.FromFile(outputPath))
{
Assert.AreEqual(ImageFormat.Png, result.RawFormat);
Assert.That(originalFileSize <= new FileInfo(outputPath).Length);
}
}
}
}
示例10: Setup
public void Setup()
{
_collectionSettings = new CollectionSettings(new NewCollectionSettings()
{
PathToSettingsFile = CollectionSettings.GetPathForNewSettings(new TemporaryFolder("BookDataTests").Path, "test"),
Language1Iso639Code = "xyz",
Language2Iso639Code = "en",
Language3Iso639Code = "fr"
});
ErrorReport.IsOkToInteractWithUser = false;
var localizationDirectory = FileLocator.GetDirectoryDistributedWithApplication("localization");
_localizationManager = LocalizationManager.Create("fr", "Bloom", "Bloom", "1.0.0", localizationDirectory, "SIL/Bloom",
null, "", new string[] {});
_palasoLocalizationManager = LocalizationManager.Create("fr", "Palaso","Palaso", "1.0.0", localizationDirectory, "SIL/Bloom",
null, "", new string[] { });
_brandingFolder = new TemporaryFolder("unitTestBrandingFolder");
_pathToBrandingSettingJson = _brandingFolder.Combine("settings.json");
}
示例11: EnsureTheseExtensionAreEnabled_AddingToExistingExtensions_NewAddedAndExistingNotDuplicated
public void EnsureTheseExtensionAreEnabled_AddingToExistingExtensions_NewAddedAndExistingNotDuplicated()
{
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 =
");
var extensions = new Dictionary<string, string>();
extensions.Add("a", "");
extensions.Add("b", "");
repository.EnsureTheseExtensionsAndFormatSet(extensions);
Assert.AreEqual(2, repository.GetEnabledExtension().Count(), "Extensions should contain just one 'a' and 'b'");
Assert.AreEqual("a", repository.GetEnabledExtension().ToArray()[0], "'a' extension was not retained.");
Assert.AreEqual("b", repository.GetEnabledExtension().ToArray()[1], "'b' extension should have been appended.");
}
}
示例12: EnsureTheseExtensionAreEnabled_ExtraExtensions_RemovesThem
public void EnsureTheseExtensionAreEnabled_ExtraExtensions_RemovesThem()
{
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(2, repository.GetEnabledExtension().Count(), "Result should have 'a' and 'b' but no 'x'");
Assert.AreEqual("a", repository.GetEnabledExtension().ToArray()[0], "'a' was not kept.");
Assert.AreEqual("b", repository.GetEnabledExtension().ToArray()[1], "'b' did not replace 'x'");
}
}
示例13: 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);
}
}
}
示例14: GetInitialStorageUsingUNCPath
private BookStorage GetInitialStorageUsingUNCPath()
{
var testFolder = new TemporaryFolder();
var bookPath = testFolder.Combine("theBook.htm");
File.WriteAllText(bookPath,
"<html><head> href='file://blahblah\\editMode.css' type='text/css' /></head><body><div class='bloom-page'></div></body></html>");
var collectionSettings = new CollectionSettings(Path.Combine(testFolder.Path, "test.bloomCollection"));
var folderPath = ConvertToNetworkPath(testFolder.Path);
Debug.WriteLine(Path.GetPathRoot(folderPath));
var storage = new BookStorage(folderPath, _fileLocator, new BookRenamedEvent(), collectionSettings);
return storage;
}
示例15: CreateXmlFileWithContents
public static TempFile CreateXmlFileWithContents(string fileName, TemporaryFolder folder, string xmlBody)
{
string path = folder.Combine(fileName);
using (var reader = XmlReader.Create(new StringReader(xmlBody)))
{
using (var writer = XmlWriter.Create(path, CanonicalXmlSettings.CreateXmlWriterSettings()))
{
writer.WriteStartDocument();
writer.WriteNode(reader, false);
}
}
return new TempFile(path, true);
}