From c123dd008add3af39136d67739002af2be3a78e4 Mon Sep 17 00:00:00 2001 From: Maarten Bosmans Date: Thu, 18 Jun 2009 18:18:01 +0200 Subject: Add some tests that depend on nunit >= 2.4 functionality --- tests/BinTest.cs | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'tests') diff --git a/tests/BinTest.cs b/tests/BinTest.cs index de40698..0b28172 100644 --- a/tests/BinTest.cs +++ b/tests/BinTest.cs @@ -99,4 +99,46 @@ public class BinTest Assert.AreEqual(elements[elements.Length - i - 1], bin.GetChildByIndex(i)); } } + + [Test] + public void TestElements() + { + Bin bin = new Bin("test-bin"); + + Element [] elements = new Element [] { + new CapsFilter(), + new MultiQueue(), + new Queue(), + new Tee(), + new TypeFindElement() + }; + + bin.Add(elements); + CollectionAssert.AreEquivalent(elements, bin.Elements); + CollectionAssert.AreEquivalent(elements, bin.ElementsRecurse); + CollectionAssert.AreEquivalent(elements, bin.ElementsSorted); + } + + [Test] + public void TestGhostPad() + { + Bin bin = new Bin(String.Empty); + Element filesrc = ElementFactory.Make("filesrc"); + bin.Add(filesrc); + CollectionAssert.IsEmpty(bin.Pads); + + GhostPad pad1 = new GhostPad("ghost-sink", PadDirection.Sink); + GhostPad pad2 = new GhostPad("ghost-src", new PadTemplate("src-template", PadDirection.Src, PadPresence.Request, Caps.NewAny())); + + Assert.IsFalse(pad1.SetTarget(filesrc.GetStaticPad("src"))); + Assert.IsTrue(pad2.SetTarget(filesrc.GetStaticPad("src"))); + + bin.AddPad(pad1); + bin.AddPad(pad2); + + CollectionAssert.Contains(bin.Pads, pad1); + CollectionAssert.Contains(bin.Pads, pad2); + CollectionAssert.Contains(bin.SinkPads, pad1); + CollectionAssert.Contains(bin.SrcPads, pad2); + } } -- cgit v1.2.3