本文整理汇总了C#中Palaso.TestUtilities.TemporaryFolder.GetPathForNewTempFile方法的典型用法代码示例。如果您正苦于以下问题:C# TemporaryFolder.GetPathForNewTempFile方法的具体用法?C# TemporaryFolder.GetPathForNewTempFile怎么用?C# TemporaryFolder.GetPathForNewTempFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Palaso.TestUtilities.TemporaryFolder
的用法示例。
在下文中一共展示了TemporaryFolder.GetPathForNewTempFile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NewEntry_ByEntry_TriggersModifiedEntryAdded
public void NewEntry_ByEntry_TriggersModifiedEntryAdded()
{
using (var f = new TemporaryFolder("eventTests"))
{
using (var r = new LiftLexEntryRepository(f.GetPathForNewTempFile(true)))
{
r.AfterEntryModified += OnEvent;
LexEntry entry = r.CreateItem();
r.SaveItem(entry);
Assert.IsTrue(_gotEventCall);
}
}
}
示例2: DeleteEntry_ByEntry_TriggersAfterEntryDeleted
public void DeleteEntry_ByEntry_TriggersAfterEntryDeleted()
{
using (TemporaryFolder f = new TemporaryFolder("eventTests"))
{
using (LiftLexEntryRepository r = new LiftLexEntryRepository(f.GetPathForNewTempFile(true)))
{
r.AfterEntryDeleted += OnEvent;
LexEntry entry = r.CreateItem();
r.SaveItem(entry);
r.DeleteItem(entry);
Assert.IsTrue(_gotEventCall);
}
}
}
示例3: TempLiftFile
public TempLiftFile(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.
{
if (parentFolder != null)
{
_path = parentFolder.GetPathForNewTempFile(false) + ".lift";
}
else
{
var temp = System.IO.Path.GetTempFileName();
_path = temp + ".lift";
File.Move(temp, _path);
}
string liftContents = string.Format("<?xml version='1.0' encoding='utf-8'?><lift version='{0}'>{1}</lift>", claimedLiftVersion, xmlOfEntries);
File.WriteAllText(_path, liftContents);
}
示例4: TempFileFromFolder
/// <summary>
/// Create a tempfile within the given parent folder
/// </summary>
public TempFileFromFolder(TemporaryFolder parentFolder)
: 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 != null ? parentFolder.GetPathForNewTempFile(true) : System.IO.Path.GetTempFileName();
}