示例#1
0
        public void CreateNoPermissionTest()
        {
            string data = "009d1cd696d5194a     no permissions";

            var device = DeviceData.CreateFromAdbData(data);

            Assert.AreEqual <string>("009d1cd696d5194a", device.Serial);
            Assert.AreEqual(DeviceState.NoPermissions, device.State);
        }
示例#2
0
        public void CreateFromEmulatorTest()
        {
            string data = "emulator-5586          host features:shell_2";

            var device = DeviceData.CreateFromAdbData(data);

            Assert.AreEqual <string>("emulator-5586", device.Serial);
            Assert.AreEqual <DeviceState>(DeviceState.Host, device.State);
            Assert.AreEqual("shell_2", device.Features);
            Assert.AreEqual(string.Empty, device.Usb);
        }
示例#3
0
        public void CreateWithUnderscoresTest()
        {
            string data = "99000000               device product:if_s200n model:NL_V100KR device:if_s200n";

            var device = DeviceData.CreateFromAdbData(data);

            Assert.AreEqual <string>("99000000", device.Serial);
            Assert.AreEqual("if_s200n", device.Product);
            Assert.AreEqual("NL_V100KR", device.Model);
            Assert.AreEqual("if_s200n", device.Name);
        }
示例#4
0
        public void CreateFromDeviceDataVSEmulatorTest()
        {
            string data = @"169.254.138.177:5555   offline product:VS Emulator Android Device - 480 x 800 model:Android_Device___480_x_800 device:donatello";

            var device = DeviceData.CreateFromAdbData(data);

            Assert.AreEqual <string>("169.254.138.177:5555", device.Serial);
            Assert.AreEqual <string>("VS Emulator Android Device - 480 x 800", device.Product);
            Assert.AreEqual <string>("Android_Device___480_x_800", device.Model);
            Assert.AreEqual <string>("donatello", device.Name);
            Assert.AreEqual <DeviceState>(DeviceState.Offline, device.State);
        }
示例#5
0
        public void CreateFromDeviceDataUnauthorizedTest()
        {
            string data = "R32D102SZAE            unauthorized";

            var device = DeviceData.CreateFromAdbData(data);

            Assert.AreEqual <string>("R32D102SZAE", device.Serial);
            Assert.AreEqual <string>("", device.Product);
            Assert.AreEqual <string>("", device.Model);
            Assert.AreEqual <string>("", device.Name);
            Assert.AreEqual <DeviceState>(DeviceState.Unauthorized, device.State);
        }
示例#6
0
        public void CreateFromDeviceDataTransportIdTest()
        {
            string data = "emulator-5554          device product:sdk_google_phone_x86 model:Android_SDK_built_for_x86 device:generic_x86 transport_id:1";

            var device = DeviceData.CreateFromAdbData(data);

            Assert.AreEqual <string>("emulator-5554", device.Serial);
            Assert.AreEqual <string>("sdk_google_phone_x86", device.Product);
            Assert.AreEqual <string>("Android_SDK_built_for_x86", device.Model);
            Assert.AreEqual <string>("generic_x86", device.Name);
            Assert.AreEqual <DeviceState>(DeviceState.Online, device.State);
        }
示例#7
0
        public void CreateFromDeviceDataTest()
        {
            string data = "99000000               device product:if_s200n model:NL_V100KR device:if_s200n";

            var device = DeviceData.CreateFromAdbData(data);

            Assert.AreEqual <string>("99000000", device.Serial);
            Assert.AreEqual <DeviceState>(DeviceState.Online, device.State);
            Assert.AreEqual <string>("if_s200n", device.Product);
            Assert.AreEqual <string>("NL_V100KR", device.Model);
            Assert.AreEqual <string>("if_s200n", device.Name);
        }
示例#8
0
        public void CreateFromDeviceDataTransportIdTest()
        {
            string data = "R32D102SZAE            device transport_id:6";

            var device = DeviceData.CreateFromAdbData(data);

            Assert.AreEqual <string>("R32D102SZAE", device.Serial);
            Assert.AreEqual <string>("", device.Product);
            Assert.AreEqual <string>("", device.Model);
            Assert.AreEqual <string>("", device.Name);
            Assert.AreEqual <DeviceState>(DeviceState.Online, device.State);
            Assert.AreEqual(string.Empty, device.Usb);
        }
示例#9
0
        public void CreateWithUsbDataTest()
        {
            // As seen on Linux
            string data = "EAOKCY112414           device usb:1-1 product:WW_K013 model:K013 device:K013_1";

            var device = DeviceData.CreateFromAdbData(data);

            Assert.AreEqual <string>("EAOKCY112414", device.Serial);
            Assert.AreEqual <DeviceState>(DeviceState.Online, device.State);
            Assert.AreEqual("K013", device.Model);
            Assert.AreEqual("WW_K013", device.Product);
            Assert.AreEqual("K013_1", device.Name);
            Assert.AreEqual("1-1", device.Usb);
        }
示例#10
0
        public void CreateWithFeaturesTest()
        {
            string data = "0100a9ee51a18f2b device product:bullhead model:Nexus_5X device:bullhead features:shell_v2,cmd";

            var device = DeviceData.CreateFromAdbData(data);

            Assert.AreEqual <string>("0100a9ee51a18f2b", device.Serial);
            Assert.AreEqual <DeviceState>(DeviceState.Online, device.State);
            Assert.AreEqual("Nexus_5X", device.Model);
            Assert.AreEqual("bullhead", device.Product);
            Assert.AreEqual("bullhead", device.Name);
            Assert.AreEqual("shell_v2,cmd", device.Features);
            Assert.AreEqual(string.Empty, device.Usb);
        }
示例#11
0
        public void CreateFromDeviceDataConnecting()
        {
            string data = "00bc13bcf4bacc62 connecting";

            var device = DeviceData.CreateFromAdbData(data);

            Assert.AreEqual <string>("00bc13bcf4bacc62", device.Serial);
            Assert.AreEqual(string.Empty, device.Product);
            Assert.AreEqual(string.Empty, device.Model);
            Assert.AreEqual(string.Empty, device.Name);
            Assert.AreEqual(string.Empty, device.TransportId);
            Assert.AreEqual <DeviceState>(DeviceState.Unknown, device.State);
            Assert.AreEqual(string.Empty, device.Usb);
        }
示例#12
0
        public void CreateFromDeviceDataTransportIdTest3()
        {
            string data = "00bc13bcf4bacc62 device product:bullhead model:Nexus_5X device:bullhead transport_id:1";

            var device = DeviceData.CreateFromAdbData(data);

            Assert.AreEqual <string>("00bc13bcf4bacc62", device.Serial);
            Assert.AreEqual <string>("bullhead", device.Product);
            Assert.AreEqual <string>("Nexus_5X", device.Model);
            Assert.AreEqual <string>("bullhead", device.Name);
            Assert.AreEqual <string>("1", device.TransportId);
            Assert.AreEqual <DeviceState>(DeviceState.Online, device.State);
            Assert.AreEqual(string.Empty, device.Usb);
        }
示例#13
0
        public void CreateWithoutModelTest()
        {
            // As seen for devices in recovery mode
            // See https://github.com/quamotion/madb/pull/85/files
            string data = "ZY3222LBDC recovery usb:337641472X product:omni_cedric device:cedric";

            var device = DeviceData.CreateFromAdbData(data);

            Assert.AreEqual <string>("ZY3222LBDC", device.Serial);
            Assert.AreEqual <DeviceState>(DeviceState.Recovery, device.State);
            Assert.AreEqual <string>("337641472X", device.Usb);
            Assert.AreEqual <string>(string.Empty, device.Model);
            Assert.AreEqual("omni_cedric", device.Product);
            Assert.AreEqual("cedric", device.Name);
        }
示例#14
0
        public void CreateFromDeviceDataAuthorizingTest()
        {
            string data = "52O00ULA01             authorizing usb:9-1.4.1 transport_id:8149";

            var device = DeviceData.CreateFromAdbData(data);

            Assert.Equal("52O00ULA01", device.Serial);
            Assert.Equal(string.Empty, device.Product);
            Assert.Equal(string.Empty, device.Model);
            Assert.Equal(string.Empty, device.Name);
            Assert.Equal(string.Empty, device.Features);
            Assert.Equal <DeviceState>(DeviceState.Authorizing, device.State);
            Assert.Equal("9-1.4.1", device.Usb);
            Assert.Equal("8149", device.TransportId);
        }
示例#15
0
        public void CreateFromDeviceNoPermissionTest2()
        {
            string data = "009d1cd696d5194a        no permissions (user in plugdev group; are your udev rules wrong?); see [http://developer.android.com/tools/device.html";

            var device = DeviceData.CreateFromAdbData(data);

            Assert.Equal("009d1cd696d5194a", device.Serial);
            Assert.Equal(string.Empty, device.Product);
            Assert.Equal(string.Empty, device.Model);
            Assert.Equal(string.Empty, device.Name);
            Assert.Equal(string.Empty, device.Features);
            Assert.Equal <DeviceState>(DeviceState.NoPermissions, device.State);
            Assert.Equal(" (user in plugdev group; are your udev rules wrong?); see [http://developer.android.com/tools/device.html", device.Message);
            Assert.Equal(string.Empty, device.Usb);
            Assert.Equal(string.Empty, device.TransportId);
        }
示例#16
0
        public void CreateFromInvalidDatatest()
        {
            string data = "xyz";

            var device = DeviceData.CreateFromAdbData(data);
        }
示例#17
0
        public void CreateFromInvalidDatatest()
        {
            string data = "xyz";

            Assert.Throws <ArgumentException>(() => DeviceData.CreateFromAdbData(data));
        }