Esempio n. 1
0
        public void DeviceClientObjectCreationWithValues()
        {
            Dictionary <string, string> data = IBMWIoTP.DeviceClient.parseFile("../../Resource/prop.txt", "## Device Registration detail");

            if (!data.TryGetValue("Organization-ID", out orgId) ||
                !data.TryGetValue("Device-Type", out deviceType) ||
                !data.TryGetValue("Device-ID", out deviceID) ||
                !data.TryGetValue("Authentication-Method", out authmethod) ||
                !data.TryGetValue("Authentication-Token", out authtoken))
            {
                throw new Exception("Invalid property file");
            }
            testClient = new IBMWIoTP.DeviceClient(orgId, deviceType, deviceID, authmethod, authtoken);
        }
Esempio n. 2
0
        public void DeviceClientAutoReconnect()
        {
            IBMWIoTP.DeviceClient.DOMAIN        = "its.not.reachable.com";
            IBMWIoTP.DeviceClient.MQTTS_PORT    = 3000;
            IBMWIoTP.DeviceClient.AutoReconnect = true;
            var canceller = new CancellationTokenSource();

            Task.Factory.StartNew(() =>
            {
                System.Threading.Thread.Sleep(1000);
                IBMWIoTP.DeviceClient.DOMAIN     = ".messaging.internetofthings.ibmcloud.com";
                IBMWIoTP.DeviceClient.MQTTS_PORT = 8883;
                System.Threading.Thread.Sleep(3000);
                testClient.connect();
                Assert.IsTrue(testClient.isConnected());
                IBMWIoTP.DeviceClient.AutoReconnect = false;
                canceller.Cancel();
            }, canceller.Token);
            testClient = new IBMWIoTP.DeviceClient("../../Resource/prop.txt");
        }
Esempio n. 3
0
 public void DeviceClientObjectCreationQuickStart()
 {
     testClient = new IBMWIoTP.DeviceClient("testdev", "12345678");
 }
Esempio n. 4
0
 public void DeviceClientObjectCreationWithError()
 {
     testClient = new IBMWIoTP.DeviceClient("", "", "", "", "");
 }
Esempio n. 5
0
 public void Setup()
 {
     IBMWIoTP.DeviceClient.AutoReconnect = false;
     testClient = new IBMWIoTP.DeviceClient("../../Resource/prop.txt");
 }
Esempio n. 6
0
 public void DeviceClientObjectCreationWithFilePathInvaidFile()
 {
     testClient = new IBMWIoTP.DeviceClient("../../Resource/propInvalid.txt");
 }
Esempio n. 7
0
 public void Setup()
 {
     testClient = new IBMWIoTP.DeviceClient("../../Resource/prop.txt");
 }