示例#1
0
        public async Task BusOperations()
        {
            if (!File.Exists("dbus-daemon"))
            {
                throw new SkipTestException("dbus-daemon not present");
            }

            using (var dbusDaemon = new DBusDaemon())
            {
                await dbusDaemon.StartAsync();

                var address = dbusDaemon.Address;

                IConnection conn1 = new Connection(address);
                await conn1.ConnectAsync();

                await conn1.ListActivatableServicesAsync();

                var exception = await Assert.ThrowsAsync <DBusException>(() => conn1.ActivateServiceAsync("com.some.service"));

                Assert.Equal("org.freedesktop.DBus.Error.ServiceUnknown", exception.ErrorName);

                var isRunning = await conn1.IsServiceActiveAsync("com.some.service");

                Assert.Equal(false, isRunning);
            }
        }