private void CreateCustomRedTeam(Table table, string key) { var factory = new TeamFactory(); var redTeam = factory.CreateTeam("rouge"); redTeam.RemoveAll(); var nbEmploye = table.Rows.Count; var employes = table.Rows; for (int i = 0; i < nbEmploye; i++) { var name = employes[i][0]; if (redTeam.employes.Exists(e => e.Name == name)) { throw new ArgumentException($"{name} already exist."); } var currentPlace = employes[i][1]; Place place; if (Enum.TryParse(currentPlace, out place)) { redTeam.employes.Add(new Employe(name, place)); } else { throw new ArgumentException($"{currentPlace} doesn't exist"); } } ScenarioContext.Current.Set(redTeam, key); }