public void CreateInterfaceTest()
        {
            BusAttachment bus = new BusAttachment("interfacetest", true, 4);

            InterfaceDescription[] secureIntf    = new InterfaceDescription[1];
            InterfaceDescription[] nonsecureIntf = new InterfaceDescription[1];

            bus.CreateInterface("secureIntf", secureIntf, true);
            bus.CreateInterface("nonsecureIntf", nonsecureIntf, false);
            secureIntf[0].AddMethod("foo", "say", "ab", "str,arr1,arr2", (byte)0, "");
            nonsecureIntf[0].AddSignal("bar", "say", "str,arr1", (byte)0, "");
            secureIntf[0].Activate();
            nonsecureIntf[0].Activate();
            Assert.IsNotNull(bus.GetInterface("secureIntf"));
            Assert.IsNotNull(bus.GetInterface("nonsecureIntf"));
            InterfaceDescription[] intfs = new InterfaceDescription[12];
            bus.GetInterfaces(intfs);
            Assert.IsNotNull(intfs[0]);
            Assert.IsNotNull(intfs[1]);

            // BUGBUG: DeleteInterface is throwing an exception saying the interfaces don't exist
            //bus.DeleteInterface(bus.GetInterface("secureIntf"));
            //bus.DeleteInterface(bus.GetInterface("nonsecureIntf"));
            //Assert.IsNull(bus.GetInterface("secureIntf"));
            //Assert.IsNull(bus.GetInterface("nonsecureIntf"));
            //InterfaceDescription[] nullIntfs = new InterfaceDescription[2];
            //bus.GetInterfaces(nullIntfs);
            //Assert.IsNull(nullIntfs[0]);
            //Assert.IsNull(nullIntfs[1]);

            // TODO: It doesn't seem like you can create multiple interfaces at a time
            //InterfaceDescription[] multiIntf = new InterfaceDescription[5];
            //bus.CreateInterface("multiIntf", multiIntf, false);

            try
            {
                InterfaceDescription nonExisting = bus.GetInterface("notThere");
                Assert.IsFalse(true);
            }
            catch (Exception ex)
            {
                Logger.LogMessage("%s", ex.Message);
            }
        }
        public void CreateInterfacesFromXMLTest()
        {
            BusAttachment bus = new BusAttachment("xmlinterfaces", true, 4);

            bus.CreateInterfacesFromXml(signalIntf);
            bus.CreateInterfacesFromXml(methodIntf);
            bus.CreateInterfacesFromXml(propertyIntf);
            bus.CreateInterfacesFromXml(mixedIntf);
            InterfaceDescription i = bus.GetInterface("org.alljoyn.Signals");

            Assert.IsNotNull(i);
            Assert.IsNotNull(bus.GetInterface("org.alljoyn.Methods"));
            Assert.IsNotNull(bus.GetInterface("org.alljoyn.Properties"));
            Assert.IsNotNull(bus.GetInterface("org.alljoyn.Mixed"));
            InterfaceDescription[] intfs = new InterfaceDescription[14];
            bus.GetInterfaces(intfs);
            Assert.IsNotNull(intfs[0]);
            Assert.IsNotNull(intfs[1]);
            Assert.IsNotNull(intfs[2]);
            Assert.IsNotNull(intfs[3]);

            // BUGBUG: DeleteInterface is throwing an exception saying the interfaces don't exist
            //bus.DeleteInterface(bus.GetInterface("org.alljoyn.Signals"));
            //bus.DeleteInterface(bus.GetInterface("org.alljoyn.Methods"));
            //bus.DeleteInterface(bus.GetInterface("org.alljoyn.Properties"));
            //bus.DeleteInterface(bus.GetInterface("org.alljoyn.Mixed"));
            //Assert.IsNull(bus.GetInterface("org.alljoyn.Signals"));
            //Assert.IsNull(bus.GetInterface("org.alljoyn.Methods"));
            //Assert.IsNull(bus.GetInterface("org.alljoyn.Properties"));
            //Assert.IsNull(bus.GetInterface("org.alljoyn.Mixed"));

            //InterfaceDescription[] nullIntfs = new InterfaceDescription[14];
            //bus.GetInterfaces(nullIntfs);
            //Assert.IsNull(nullIntfs[0]);
            //Assert.IsNull(nullIntfs[1]);
            //Assert.IsNull(nullIntfs[2]);
            //Assert.IsNull(nullIntfs[3]);
        }
        public void CreateInterfacesFromXMLTest()
        {
            BusAttachment bus = new BusAttachment("xmlinterfaces", true, 4);

            bus.CreateInterfacesFromXml(signalIntf);
            bus.CreateInterfacesFromXml(methodIntf);
            bus.CreateInterfacesFromXml(propertyIntf);
            bus.CreateInterfacesFromXml(mixedIntf);
            InterfaceDescription i = bus.GetInterface("org.alljoyn.Signals");
            Assert.IsNotNull(i);
            Assert.IsNotNull(bus.GetInterface("org.alljoyn.Methods"));
            Assert.IsNotNull(bus.GetInterface("org.alljoyn.Properties"));
            Assert.IsNotNull(bus.GetInterface("org.alljoyn.Mixed"));
            InterfaceDescription[] intfs = new InterfaceDescription[14];
            bus.GetInterfaces(intfs);
            Assert.IsNotNull(intfs[0]);
            Assert.IsNotNull(intfs[1]);
            Assert.IsNotNull(intfs[2]);
            Assert.IsNotNull(intfs[3]);

            // BUGBUG: DeleteInterface is throwing an exception saying the interfaces don't exist
            //bus.DeleteInterface(bus.GetInterface("org.alljoyn.Signals"));
            //bus.DeleteInterface(bus.GetInterface("org.alljoyn.Methods"));
            //bus.DeleteInterface(bus.GetInterface("org.alljoyn.Properties"));
            //bus.DeleteInterface(bus.GetInterface("org.alljoyn.Mixed"));
            //Assert.IsNull(bus.GetInterface("org.alljoyn.Signals"));
            //Assert.IsNull(bus.GetInterface("org.alljoyn.Methods"));
            //Assert.IsNull(bus.GetInterface("org.alljoyn.Properties"));
            //Assert.IsNull(bus.GetInterface("org.alljoyn.Mixed"));

            //InterfaceDescription[] nullIntfs = new InterfaceDescription[14];
            //bus.GetInterfaces(nullIntfs);
            //Assert.IsNull(nullIntfs[0]);
            //Assert.IsNull(nullIntfs[1]);
            //Assert.IsNull(nullIntfs[2]);
            //Assert.IsNull(nullIntfs[3]);
        }
        public void CreateInterfaceTest()
        {
            BusAttachment bus = new BusAttachment("interfacetest", true, 4);
            InterfaceDescription[] secureIntf = new InterfaceDescription[1];
            InterfaceDescription[] nonsecureIntf = new InterfaceDescription[1];

            bus.CreateInterface("secureIntf", secureIntf, true);
            bus.CreateInterface("nonsecureIntf", nonsecureIntf, false);
            secureIntf[0].AddMethod("foo", "say", "ab", "str,arr1,arr2", (byte)0, "");
            nonsecureIntf[0].AddSignal("bar", "say", "str,arr1", (byte)0, "");
            secureIntf[0].Activate();
            nonsecureIntf[0].Activate();
            Assert.IsNotNull(bus.GetInterface("secureIntf"));
            Assert.IsNotNull(bus.GetInterface("nonsecureIntf"));
            InterfaceDescription[] intfs = new InterfaceDescription[12];
            bus.GetInterfaces(intfs);
            Assert.IsNotNull(intfs[0]);
            Assert.IsNotNull(intfs[1]);

            // BUGBUG: DeleteInterface is throwing an exception saying the interfaces don't exist
            //bus.DeleteInterface(bus.GetInterface("secureIntf"));
            //bus.DeleteInterface(bus.GetInterface("nonsecureIntf"));
            //Assert.IsNull(bus.GetInterface("secureIntf"));
            //Assert.IsNull(bus.GetInterface("nonsecureIntf"));
            //InterfaceDescription[] nullIntfs = new InterfaceDescription[2];
            //bus.GetInterfaces(nullIntfs);
            //Assert.IsNull(nullIntfs[0]);
            //Assert.IsNull(nullIntfs[1]);

            // TODO: It doesn't seem like you can create multiple interfaces at a time
            //InterfaceDescription[] multiIntf = new InterfaceDescription[5];
            //bus.CreateInterface("multiIntf", multiIntf, false);

            try
            {
                InterfaceDescription nonExisting = bus.GetInterface("notThere");
                Assert.IsFalse(true);
            }
            catch (Exception ex)
            {
                Logger.LogMessage("%s", ex.Message);
            }
        }