本文整理汇总了C#中Provider.UpdateEntry方法的典型用法代码示例。如果您正苦于以下问题:C# Provider.UpdateEntry方法的具体用法?C# Provider.UpdateEntry怎么用?C# Provider.UpdateEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Provider
的用法示例。
在下文中一共展示了Provider.UpdateEntry方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestUpdateEntryHandlesPathWithSlash
public void TestUpdateEntryHandlesPathWithSlash()
{
var p = new Provider("FileSystem");
Assert.AreEqual(0, p.Entries.Count);
Assert.IsTrue(p.UpdateEntry(@"c:\dir1", s => false));
Assert.AreEqual(1, p.Entries.Count);
Assert.IsTrue(p.UpdateEntry(@"c:\dir1\", s => false));
Assert.AreEqual(1, p.Entries.Count);
}
示例2: TestUpdateNonExistentEntryShouldSucceed
public void TestUpdateNonExistentEntryShouldSucceed()
{
var p = new Provider("FileSystem");
using (var ms = new MemoryStream(Encoding.UTF8.GetBytes(TestData.GetTwoDirFilesystem())))
{
p.Load(new StreamReader(ms));
}
var now = DateTime.UtcNow;
var newStr = "c:\tree\newEntry";
Assert.IsTrue(p.UpdateEntry(newStr,s => s.EndsWith("newentry",StringComparison.Ordinal)));
var entry = p.Entries.Values.OfType<Entry>().First(e => e.FullPath == newStr);
StringAssert.AreEqualIgnoringCase(newStr, entry.FullPath);
Assert.AreEqual(1, entry.Frequency);
Assert.GreaterOrEqual(entry.LastAccessTime, now);
}
示例3: TestUpdateEntry
public void TestUpdateEntry()
{
var p = new Provider ("FileSystem");
using (var ms = new MemoryStream(Encoding.UTF8.GetBytes(TestData.GetTwoDirFilesystem())))
{
p.Load(new StreamReader(ms));
}
var f = p.Entries [0].Frequency;
var now = DateTime.UtcNow;
Assert.IsTrue(p.UpdateEntry (TestData.Dir1.FullPath));
Assert.AreEqual (f + 1, p.Entries [0].Frequency);
Assert.GreaterOrEqual(p.Entries [0].LastAccessTime, now);
}
示例4: TestUpdateNonExistentEntryShouldFail
public void TestUpdateNonExistentEntryShouldFail()
{
var p = new Provider("FileSystem");
using (var ms = new MemoryStream(Encoding.UTF8.GetBytes(TestData.GetTwoDirFilesystem())))
{
p.Load(new StreamReader(ms));
}
Assert.AreEqual(false, p.UpdateEntry(-1));
}