GetFirstMatch() public method

public GetFirstMatch ( DeviceInfo device ) : DeviceInfo
device DeviceInfo
return DeviceInfo
Example #1
0
        public void TestNoMatch()
        {
            var client = new RegistrarClient(BaseUrl, new JsonProvider());

            var info = new DeviceInfo
            {
                DeviceModel = "aDevice",
                IP = "0.0.0.0",
                MobileOs = MobileOs.None,
                OsVersion = "1.0",
                UniqueId = "0"
            };

            Assert.IsNull(client.GetFirstMatch(info));
        }
Example #2
0
        public void TestAvailibility()
        {
            var client = new RegistrarClient(BaseUrl, new JsonProvider());

            var info = new DeviceInfo
            {
                DeviceModel = "aDevice",
                IP = "0.0.0.0",
                MobileOs = MobileOs.None,
                OsVersion = "1.0",
                UniqueId = "0"
            };

            client.Register(info);

            client.SetAvailibility(info, false);
            // Unavailible devices shouldn't be found in GetFirstMatch
            Assert.IsNull(client.GetFirstMatch(info));

            client.SetAvailibility(info, true);
            // Availible devices should be found
            var match = client.GetFirstMatch(info);
            Assert.IsTrue(info.IP == match.IP, "Actual: {0} Expected: {1}", match.IP, info.IP);
        }
Example #3
0
        public void TestRegistration()
        {
            var client = new RegistrarClient(BaseUrl, new JsonProvider());

            var info = new DeviceInfo
            {
                DeviceModel = "aDevice",
                IP = "0.0.0.0",
                MobileOs = MobileOs.None,
                OsVersion = "1.0",
                UniqueId = "0"
            };

            client.Register(info);
            var match = client.GetFirstMatch(info);
            Assert.IsTrue(info.IP == match.IP, "Actual: {0} Expected: {1}", match.IP, info.IP);
        }