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


C# InMemoryViewFolder.ListViews方法代码示例

本文整理汇总了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"));
        }
开发者ID:Eilon,项目名称:spark,代码行数:41,代码来源:SubViewFolderTester.cs

示例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);
        }
开发者ID:subdigital,项目名称:spark,代码行数:19,代码来源:InMemoryViewFolderTester.cs


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