GetFirstMatch() public method

public GetFirstMatch ( DeviceInfo device ) : DeviceInfo
device DeviceInfo
return DeviceInfo
コード例 #1
0
ファイル: WebApiTests.cs プロジェクト: vistaprint/automobile
        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));
        }
コード例 #2
0
ファイル: WebApiTests.cs プロジェクト: vistaprint/automobile
        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);
        }
コード例 #3
0
ファイル: WebApiTests.cs プロジェクト: vistaprint/automobile
        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);
        }