示例#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);
        }
示例#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");
        }
示例#3
0
 public void DeviceClientObjectCreationQuickStart()
 {
     testClient = new IBMWIoTP.DeviceClient("testdev", "12345678");
 }
示例#4
0
 public void DeviceClientObjectCreationWithError()
 {
     testClient = new IBMWIoTP.DeviceClient("", "", "", "", "");
 }
示例#5
0
 public void Setup()
 {
     IBMWIoTP.DeviceClient.AutoReconnect = false;
     testClient = new IBMWIoTP.DeviceClient("../../Resource/prop.txt");
 }
示例#6
0
 public void DeviceClientObjectCreationWithFilePathInvaidFile()
 {
     testClient = new IBMWIoTP.DeviceClient("../../Resource/propInvalid.txt");
 }
示例#7
0
 public void Setup()
 {
     testClient = new IBMWIoTP.DeviceClient("../../Resource/prop.txt");
 }