Exemplo n.º 1
0
            public UDiskDevice GetUSBDevice()
            {
                // Just return the first USB device we find.  Throw if there isn't one.
                var uDisks = new UDisks();

                foreach (var device in uDisks.EnumerateDeviceOnInterface("usb"))
                {
                    return(new UDiskDevice(device));
                }
                throw new DriveNotFoundException("No USB drive available. Insert a USB drive for this test");
            }
Exemplo n.º 2
0
        public void EnumerateUSB_HasOnlyPartitions()
        {
            var disks   = new UDisks();
            var devices = disks.EnumerateDeviceOnInterface("usb");

            Assert.Greater(devices.Count(), 0);
            foreach (var device in devices)
            {
                var uDiskDevice = new UDiskDevice(device);
                Assert.AreEqual("True", uDiskDevice.GetProperty("DeviceIsPartition"),
                                String.Format("Device {0} does not have a partition", device)
                                );
            }
        }
Exemplo n.º 3
0
        public void EnumerateUSB_HasOnlyUSBDevices()
        {
            var disks   = new UDisks();
            var devices = disks.EnumerateDeviceOnInterface("usb");

            Assert.Greater(devices.Count(), 0);
            // Check that the devices don't exist on any interface other than usb
            foreach (var device in devices)
            {
                var    uDiskDevice = new UDiskDevice(device);
                string iface       = uDiskDevice.GetProperty("DriveConnectionInterface");
                Assert.AreEqual("usb", iface);
            }
        }