public static string[] GetSpeciesList(string prefixText, int count) { IEnumerable <Species> list = SpeciesMapper.SelectAll() .Where(x => x.AlphaCode.StartsWith(prefixText)) .OrderBy(x => x.AlphaCode) .Take(count); List <string> arrayList = new List <string>(); foreach (Species s in list) { arrayList.Add(s.AlphaCode + " (" + s.CommonName + ")"); } return(arrayList.ToArray <string>()); }
public void t_Species_Select_All() { // Backdoor setup List <Species_ado> list = DbTestHelper.LoadExtraneousSpecies(); // Exercise the test List <Species> speciesList = SpeciesMapper.SelectAll(); // Validate results Assert.AreEqual(list.Count(), speciesList.Count, "Wrong number of objects in the result list"); foreach (Species_ado ado in list) { // just check to make sure the object is there; leave specific value check for the Select_ByGuid test Assert.IsTrue(speciesList.Exists(x => x.Id.Equals(ado.SpeciesId)), "Species_ado " + ado.SpeciesId.ToString() + " is not in the results"); } }