Exemple #1
0
        public void GetDeviceByIdentifier_shouldReturnNullWhenNoDeviceWithProvidedIdentifier()
        {
            DeviceCollection collection = new DeviceCollection();

            Assert.IsNull(collection.GetDeviceWithIdentifier("usb:12345"));

            Device testDevice = new Device();

            testDevice.Identifier = "usb:54321";
            testDevice.Name       = "Test device";
            collection.Devices.Add(testDevice);

            Assert.IsNull(collection.GetDeviceWithIdentifier("usb:12345"));
        }
Exemple #2
0
        public void GetDeviceByIdentifier_shouldReturnDeviceWithMatchingIdentifier()
        {
            DeviceCollection collection = new DeviceCollection();
            Device           testDevice = new Device();

            testDevice.Identifier = "usb:54321";
            testDevice.Name       = "Test device";
            collection.Devices.Add(testDevice);


            Assert.AreEqual(testDevice, collection.GetDeviceWithIdentifier("usb:54321"));


            Assert.IsNull(collection.GetDeviceWithIdentifier("usb:12345"));
        }
Exemple #3
0
        public void DeleteByIdentifier_shouldDeleteDeviceWithMatchingIdentifier()
        {
            DeviceCollection collection = new DeviceCollection();
            Device           testDevice = new Device();

            testDevice.Identifier = "usb:54321";
            testDevice.Name       = "Test device";
            collection.Devices.Add(testDevice);

            collection.DeleteByIdentifier("usb:54321");

            Assert.IsNull(collection.GetDeviceWithIdentifier("usb:54321"));
        }