本文整理汇总了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");
}
示例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");
}
示例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");
}
示例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");
}
示例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");
}