Exemple #1
0
        public void CheckForConfiguredDevices_ShouldCallGetDeviceIdsOnPortableDevicesService()
        {
            string[] listOfIds = new string[] { "id1" };

            Expect.Call(portableDevicesService.GetDeviceIds()).Return(listOfIds);
            mocks.ReplayAll();

            manager.CheckForNewDevices();

            mocks.VerifyAll();
        }
Exemple #2
0
        public void CheckForNewDevices()
        {
            string[] idsOfConnectedDevices = portableDevicesService.GetDeviceIds();
            foreach (string id in idsOfConnectedDevices)
            {
                if (CheckIfDeviceAlreadyRecognized(id))
                {
                    continue;
                }

                IEnumerable <Device> recognizedList = from c in configuredDevices.Devices where c.Identifier == id select c;
                if (recognizedList.Count() == 0)
                {
                    continue;
                }

                CompatibleDevice compatibleDevice = portableDevicesService.GetDeviceById(id);
                compatibleDevice.Connect();

                connectedDevices.Add(compatibleDevice);
                OnNewDeviceConnected(compatibleDevice);
            }
        }