本文整理汇总了C#中InMemoryViewFolder.ListViews方法的典型用法代码示例。如果您正苦于以下问题:C# InMemoryViewFolder.ListViews方法的具体用法?C# InMemoryViewFolder.ListViews怎么用?C# InMemoryViewFolder.ListViews使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InMemoryViewFolder
的用法示例。
在下文中一共展示了InMemoryViewFolder.ListViews方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ForwardAndBackSlashAreInterchangeable
public void ForwardAndBackSlashAreInterchangeable()
{
var viewsFolder = new InMemoryViewFolder
{
{@"Home\Index.spark", "1"},
{@"Shared\_global.spark", "2"},
{@"Collision\Home\Baaz.spark", "6"}
};
var extraFolder = new InMemoryViewFolder
{
{@"Home\Foo.spark", "3"},
{@"Home\Bar.spark", "4"},
{@"Home\Quux.spark", "5"},
};
Assert.AreEqual(1, viewsFolder.ListViews(@"Collision/Home").Count);
Assert.AreEqual(1, viewsFolder.ListViews(@"Collision\Home").Count);
Assert.AreEqual(3, extraFolder.ListViews(@"Home").Count);
var combinedFolder = viewsFolder
.Append(new SubViewFolder(extraFolder, @"Extra/One"))
.Append(new SubViewFolder(extraFolder, @"Extra\Two"))
.Append(new SubViewFolder(extraFolder, @"Collision"));
Assert.AreEqual(1, combinedFolder.ListViews("Home").Count);
Assert.AreEqual(3, combinedFolder.ListViews(@"Extra/One/Home").Count);
Assert.AreEqual(3, combinedFolder.ListViews(@"Extra\One/Home").Count);
Assert.AreEqual(3, combinedFolder.ListViews(@"Extra/One\Home").Count);
Assert.AreEqual(3, combinedFolder.ListViews(@"Extra\One\Home").Count);
Assert.AreEqual(3, combinedFolder.ListViews(@"Extra/Two/Home").Count);
Assert.AreEqual(3, combinedFolder.ListViews(@"Extra\Two/Home").Count);
Assert.AreEqual(3, combinedFolder.ListViews(@"Extra/Two\Home").Count);
Assert.AreEqual(3, combinedFolder.ListViews(@"Extra\Two\Home").Count);
Assert.AreEqual(4, combinedFolder.ListViews(@"Collision/Home").Count);
Assert.AreEqual(4, combinedFolder.ListViews(@"Collision\Home").Count);
Assert.IsTrue(combinedFolder.HasView(@"Extra/One/Home/Bar.spark"));
Assert.IsTrue(combinedFolder.HasView(@"Extra\One\Home\Bar.spark"));
Assert.IsTrue(combinedFolder.HasView(@"Extra/Two/Home/Bar.spark"));
Assert.IsTrue(combinedFolder.HasView(@"Extra\Two\Home\Bar.spark"));
}
示例2: ListViewsInFolder
public void ListViewsInFolder()
{
var folder = new InMemoryViewFolder
{
{"Home\\Alpha.spark", "stuff"},
{"Home\\Beta.spark", "stuff"},
{"Home2\\Gamma.spark", "stuff"},
{"home\\Delta.spark", "stuff"},
{"Home\\Something\\else.spark", "stuff"}
};
var views = folder.ListViews("Home");
var baseNames = views.Select(v => Path.GetFileNameWithoutExtension(v)).ToArray();
Assert.AreEqual(3, baseNames.Count());
Assert.Contains("Alpha", baseNames);
Assert.Contains("Beta", baseNames);
Assert.Contains("Delta", baseNames);
}