public TestMachine GetMachineByIndex(TestMachineTypeEnum type, int index) { List <TestMachine> machines = null; machines = GetMachinesByType(type); if ((machines.Count == 0) || (machines.Count <= index)) { throw new IndexOutOfRangeException(String.Format("the index: {0}, is out of range: 0-{1}", index, (machines.Count - 1))); } return(machines[index]); }
public static List <TestMachine> GetTestMachine(string systemName, TestMachineTypeEnum machineType, MatchTypeEnum matchType = MatchTypeEnum.Exact) { TestSystem testSystem = GetTestSystem(systemName); switch (matchType) { case MatchTypeEnum.Exact: return(testSystem.GetMachinesByType(machineType)); case MatchTypeEnum.Contains: return(testSystem.GetMachinesContainsType(machineType)); default: throw new ArgumentException($"unrecognized match type: {Enum.GetName(typeof(MatchTypeEnum), matchType)}", "matchType"); } }
public List <string> GetMachinesHosts(TestMachineTypeEnum type) { List <string> hosts = null; List <TestMachine> list = GetMachinesByType(type); foreach (TestMachine machine in list) { if (hosts == null) { hosts = new List <string>(); } hosts.Add(machine.Host); } return(hosts); }
public List <TestMachine> GetMachinesByType(TestMachineTypeEnum types = TestMachineTypeEnum.None) { if ((int)types == (int)TestMachineTypeEnum.None) { return(this.Machines); } List <TestMachine> machines = new List <TestMachine>(); foreach (TestMachine machine in this.Machines) { if ((machine.MachineTypes ^ types) == 0) { machines.Add(machine); } } return(machines); }
public static List <TestMachine> GetTestMachine(long systemId, TestMachineTypeEnum machineType, MatchTypeEnum matchType = MatchTypeEnum.Exact) { return(GetTestMachine(GetTestSystemNameById(systemId), machineType, matchType)); }
public static List <TestMachine> FilterMachinesByType(List <TestMachine> machines, TestMachineTypeEnum machineType) { return(machines.FindAll(i => (i.MachineTypes & machineType) > 0)); }