summaryrefslogtreecommitdiff
path: root/tests/BinTest.cs
blob: 95d839f19de38e03db14fdf20c19ae3f4fb2b438 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//
// BinTest.cs: NUnit Test Suite for gstreamer-sharp
//
// Authors:
//   Aaron Bockover (abockover@novell.com)
//
// (C) 2006 Novell, Inc.
//

using System;
using NUnit.Framework;

using Gst;

[TestFixture]
public class BinTest
{
    [TestFixtureSetUp]
    public void Init()
    {
        Application.Init();
    }
    
    [TestFixtureTearDown]
    public void Deinit()
    {
        Application.Deinit();
    }

    [Test]
    public void TestAddMany()
    {
        Bin bin = new Bin("test-bin");
        Element e1 = ElementFactory.Make("fakesrc", "fakesrc");
        Element e2 = ElementFactory.Make("fakesink", "fakesink");
        bin.AddMany(e1, e2);
        
        Assert.AreEqual(bin.List.Length, 2);
        
        e1.Dispose();
        e2.Dispose();
        bin.Dispose();
    }
    
    [Test]
    public void TestGetByName()
    {
        Bin bin = new Bin("test-bin");
        Element e1 = ElementFactory.Make("fakesrc", "element-name");
        bin.Add(e1);
        
        e1 = bin.GetByName("element-name");
        
        Assert.IsNotNull(e1);
        Assert.AreEqual(e1.Name, "element-name");
        
        e1.Dispose();
        bin.Dispose();
    }
}