public void GetDevicesOfType(string classificationName) { var deviceManager = new DeviceManager(); var classification = new DeviceClass() { Name = classificationName }; deviceManager.Devices = new List<IDevice>() { new Device() { Classification = classification } }; var devicesByClassification = deviceManager.GetDevicesOfType(classification); Assert.Equal(1, devicesByClassification.Count()); Assert.Equal(classificationName, devicesByClassification.FirstOrDefault().Classification.Name); var devicesByClassificationName = deviceManager.GetDevicesOfType(classification); Assert.Equal(1, devicesByClassificationName.Count()); Assert.Equal(classificationName, devicesByClassificationName.FirstOrDefault().Classification.Name); }
public List<IDevice> GetDevicesOfType(DeviceClass deviceClass) { var type = Devices?.Where(d => d.Classification != null && d.Classification.Equals(deviceClass)); return Devices?.Where(d => d.Classification != null && d.Classification.Equals(deviceClass)).ToList(); }
public List <IDevice> GetDevicesOfType(DeviceClass deviceClass) { var type = Devices?.Where(d => d.Classification != null && d.Classification.Equals(deviceClass)); return(Devices?.Where(d => d.Classification != null && d.Classification.Equals(deviceClass)).ToList()); }