File: BusTests.cs

package info (click to toggle)
dbus-sharp 0.8.1-2.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 868 kB
  • sloc: cs: 7,690; sh: 494; makefile: 181
file content (45 lines) | stat: -rw-r--r-- 1,042 bytes parent folder | download | duplicates (3)
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
using System;
using NUnit.Framework;
using DBus;

namespace DBus.Tests
{
	[TestFixture]
	public class BusTests
	{
		/// <summary>
		/// Tests that re-opening a bus with the same address works (in other words that closing a connection works)
		/// </summary>
		[Test]
		public void ReopenedBusIsConnected()
		{
			var address = Environment.GetEnvironmentVariable ("DBUS_SESSION_BUS_ADDRESS");
			var bus = Bus.Open (address);
			Assert.IsTrue (bus.IsConnected);
			bus.Close ();
			bus = Bus.Open (address);
			Assert.IsTrue (bus.IsConnected);
		}

		[Test]
		public void GetIdFromBusTest ()
		{
			var sessionID = Bus.Session.GetId ();
			var systemID = Bus.System.GetId (); 
			Assert.IsNotNull (sessionID);
			Assert.IsNotNull (systemID);
			Assert.AreNotEqual (systemID, sessionID);
		}

		[Test]
		public void DefaultBusesHaveUniqueName ()
		{
			var name = Bus.Session.UniqueName;
			Assert.IsNotNull (name);
			Assert.IsNotEmpty (name);
			name = Bus.System.UniqueName;
			Assert.IsNotNull (name);
			Assert.IsNotEmpty (name);
		}
	}
}