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


C# Locator.FindBy方法代码示例

本文整理汇总了C#中Locator.FindBy方法的典型用法代码示例。如果您正苦于以下问题:C# Locator.FindBy方法的具体用法?C# Locator.FindBy怎么用?C# Locator.FindBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Locator的用法示例。


在下文中一共展示了Locator.FindBy方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NullPredicateOnFindByThrows

        public void NullPredicateOnFindByThrows()
        {
            IReadWriteLocator locator = new Locator();

            locator.FindBy(null);
        }
开发者ID:bnantz,项目名称:NCS-V2-0,代码行数:6,代码来源:LocatorFixture.cs

示例2: BadSearchModeOnFindByThrows

        public void BadSearchModeOnFindByThrows()
        {
            IReadWriteLocator locator = new Locator();

            locator.FindBy((SearchMode)254, delegate { return true; });
        }
开发者ID:bnantz,项目名称:NCS-V2-0,代码行数:6,代码来源:LocatorFixture.cs

示例3: FindingByPredicateReturnsClosestResultsOnDuplicateKey

        public void FindingByPredicateReturnsClosestResultsOnDuplicateKey()
        {
            object o1 = new object();
            object o2 = new object();
            IReadWriteLocator rootLocator = new Locator();
            IReadWriteLocator childLocator = new Locator(rootLocator);

            rootLocator.Add("foo", o1);
            childLocator.Add("foo", o2);

            IReadableLocator results;

            results = childLocator.FindBy(
                SearchMode.Up,
                delegate(KeyValuePair<object, object> kvp)
                {
                    return true;
                });

            Assert.AreEqual(1, results.Count);
            Assert.AreSame(o2, results.Get("foo"));
        }
开发者ID:bnantz,项目名称:NCS-V2-0,代码行数:22,代码来源:LocatorFixture.cs

示例4: FindingByPredicateCanFindsResultsFromBothParentAndChild

        public void FindingByPredicateCanFindsResultsFromBothParentAndChild()
        {
            object o = new object();
            string s = "Hello world";
            IReadWriteLocator rootLocator = new Locator();
            IReadWriteLocator childLocator = new Locator(rootLocator);

            rootLocator.Add("foo", o);
            childLocator.Add("bar", s);

            IReadableLocator results;

            results = childLocator.FindBy(
                SearchMode.Up,
                delegate(KeyValuePair<object, object> kvp)
                {
                    return true;
                });

            Assert.AreEqual(2, results.Count);
            Assert.AreSame(o, results.Get("foo"));
            Assert.AreSame(s, results.Get("bar"));
        }
开发者ID:bnantz,项目名称:NCS-V2-0,代码行数:23,代码来源:LocatorFixture.cs

示例5: FindingByPredicateCanClimbTheTree

        public void FindingByPredicateCanClimbTheTree()
        {
            object o = new object();
            IReadWriteLocator rootLocator = new Locator();
            IReadWriteLocator childLocator = new Locator(rootLocator);

            rootLocator.Add("bar", o);

            IReadableLocator results;

            results = childLocator.FindBy(
                SearchMode.Up,
                delegate(KeyValuePair<object, object> kvp)
                {
                    return true;
                });

            Assert.AreEqual(1, results.Count);
            Assert.AreSame(o, results.Get("bar"));
        }
开发者ID:bnantz,项目名称:NCS-V2-0,代码行数:20,代码来源:LocatorFixture.cs

示例6: DefaultFindByBehaviorIsAskParent

        public void DefaultFindByBehaviorIsAskParent()
        {
            object o = new object();
            IReadWriteLocator rootLocator = new Locator();
            IReadWriteLocator childLocator = new Locator(rootLocator);

            rootLocator.Add("foo", o);

            IReadableLocator results;

            results = childLocator.FindBy(delegate(KeyValuePair<object, object> kvp)
                                                                            {
                                                                                return true;
                                                                            });

            Assert.AreEqual(1, results.Count);
        }
开发者ID:bnantz,项目名称:NCS-V2-0,代码行数:17,代码来源:LocatorFixture.cs

示例7: CanFindByPredicate

        public void CanFindByPredicate()
        {
            bool wasCalled = false;
            object o1 = new object();
            object o2 = new object();
            IReadWriteLocator locator = new Locator();

            locator.Add("foo1", o1);
            locator.Add("foo2", o2);

            IReadableLocator results;

            results = locator.FindBy(
                delegate(KeyValuePair<object, object> kvp)
                {
                    wasCalled = true;
                    return kvp.Key.Equals("foo1");
                });

            Assert.IsNotNull(results);
            Assert.IsTrue(wasCalled);
            Assert.AreEqual(1, results.Count);
            Assert.AreSame(o1, results.Get("foo1"));
        }
开发者ID:bnantz,项目名称:NCS-V2-0,代码行数:24,代码来源:LocatorFixture.cs


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