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


C# Port.TestForElement方法代码示例

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


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

示例1: TestPortElementNextPropertyWithSinglePost

        public void TestPortElementNextPropertyWithSinglePost()
        {
            var p = new Port<int> ();
            p.Post (33);
            var res0 = p.TestForElement ();

            Assert.AreEqual (res0, res0.Next, "#1");
            Assert.AreEqual (res0, res0.Previous, "#2");
        }
开发者ID:kumpera,项目名称:Ccr,代码行数:9,代码来源:PortTest.cs

示例2: TestPortElementNextProperty

        public void TestPortElementNextProperty()
        {
            var p = new Port<int> ();
            p.Post (33);
            p.Post (44);
            p.Post (55);
            p.Post (66);

            var res0 = p.TestForElement ();
            var res1 = res0.Next;
            var res2 = res1.Next;
            var res3 = res2.Next;

            Assert.AreEqual (33, res0.Item, "#1");
            Assert.AreEqual (res1, res0.Next, "#2");
            Assert.AreEqual (res3, res0.Previous, "#12");

            Assert.AreEqual (44, res1.Item, "#3");
            Assert.IsNotNull (res1.Next, "#4");
            Assert.AreEqual (res3, res1.Previous, "#5");

            Assert.AreEqual (55, res2.Item, "#6");
            Assert.IsNotNull (res2.Next, "#7");
            Assert.AreEqual (res1, res2.Previous, "#8");

            Assert.AreEqual (66, res3.Item, "#9");
            Assert.AreEqual (res1, res3.Next, "#10");
            Assert.AreEqual (res2, res3.Previous, "#11");
        }
开发者ID:kumpera,项目名称:Ccr,代码行数:29,代码来源:PortTest.cs

示例3: PostElementThenTestForElement

        public void PostElementThenTestForElement()
        {
            int tmp;
            var p = new Port<int> ();
            ;			var elem = new PortElement<int> (99);
            p.PostElement (elem);

            Assert.AreEqual (1, p.ItemCount, "#1");
            var res = p.TestForElement ();
            Assert.AreEqual (elem, res, "#2");
            Assert.AreEqual (0, p.ItemCount, "#3");
            Assert.AreEqual (null, res.Owner, "#4");
        }
开发者ID:kumpera,项目名称:Ccr,代码行数:13,代码来源:PortTest.cs

示例4: PostThenTestForElement

        public void PostThenTestForElement()
        {
            var p = new Port<int> ();
            p.Post (33);
            p.Post (44);

            var res = p.TestForElement ();
            Assert.IsNotNull (res, "#1");
            Assert.IsNull (res.CausalityContext, "#1");
            Assert.AreEqual (33, res.Item,  "#2");
            Assert.IsNotNull (res.Next, "#3");
            Assert.AreEqual (p, res.Owner, "#4");
            Assert.AreEqual (res.Next, res.Previous, "#5");

            Assert.IsTrue (res is IPortElement<int>,  "#6");
            var typed = (IPortElement<int>)res;
            Assert.AreEqual (33, typed.TypedItem, "#7");
        }
开发者ID:kumpera,项目名称:Ccr,代码行数:18,代码来源:PortTest.cs

示例5: PostElementCausesLinking

        public void PostElementCausesLinking()
        {
            var p = new Port<int> ();
            p.Post (10);
            p.PostElement (new PortElement<int> (20));
            p.Post (30);

            var r0 = p.TestForElement ();

            var r1 = r0.Next;
            Assert.IsNotNull (r1, "#1");
            var r2 = r1.Next;
            Assert.IsNotNull (r2, "#1");
            Assert.AreEqual (r1, r2.Previous, "#2");
            Assert.AreEqual (r2, r1.Previous, "#3");
        }
开发者ID:kumpera,项目名称:Ccr,代码行数:16,代码来源:PortTest.cs


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