public void WhenNis95to99TheLastElementIs95(int n) { var result = ListExercises.MakeFiveList(n); var lastPos = result.Count - 1; Assert.AreEqual(95, result[lastPos]); }
public void IfTheListIsEmptyTheAverageIsZero() { var argList = new List <double>(); var result = ListExercises.Average(argList); Assert.AreEqual(0, result); }
public static void Main(string[] args) { List myList = new List(); for (int i = 0; i < 4; i++) { ListExercises list1 = new ListExercises(); Console.WriteLine("Enter a name"); list1.SetName(Console.ReadLine()); if (myList.AddName(list1) == true) { Console.WriteLine("Person Added"); } else { Console.WriteLine("No more space"); Console.ReadLine(); } Console.WriteLine("Enter a name to find the position of: "); string personToFindPositionOf = Console.ReadLine(); Console.WriteLine(personToFindPositionOf + "'s position is " + myList.GetPosition(personToFindPositionOf)); } }
public void IfTheListIsEmptyAnEmptyListIsReturned() { var argList = new List <string>(); var result = ListExercises.MakeAList(argList); Assert.AreEqual(0, result.Count); }
public void GivenAListIsTheAverageCorrect() { var argList = new List <double> { 5, 2, 6, 1 }; var result = ListExercises.Average(argList); Assert.AreEqual(3.5, result); }
public void IfTheListHasTwoWordsStartingWithAListOfSize2IsReturned() { var argList = new List <string> { "Cat", "Aarvaark", "ant", "Dog", "Budgie" }; var result = ListExercises.MakeAList(argList); Assert.AreEqual(2, result.Count); }
public void IfTheListHasNoWordsStartingWithAAnEmptyListIsReturned() { var argList = new List <string> { "Cat", "Dog", "Budgie" }; var result = ListExercises.MakeAList(argList); Assert.AreEqual(0, result.Count); }
public void IfTheListHasaWordsStartingWithATheWordIsReturned() { var argList = new List <string> { "Cat", "Aardvark", "Dog", "Budgie" }; var result = ListExercises.MakeAList(argList); Assert.AreEqual(1, result.Count); Assert.Contains("Aardvark", result); }
public void IfTheListHasTwoWordsStartingWithATheCorrectWordsAreReturned() { var argList = new List <string> { "Cat", "Aardvark", "ant", "Dog", "Budgie" }; var result = ListExercises.MakeAList(argList); Assert.Contains("Aardvark", result); Assert.Contains("ant", result); }
public static void Main(String[] args) { ListExercises myList = new ListExercises(); Console.WriteLine("Enter five names, one per line"); for (int i = 0; i < 5; i++) { myList.AddNameToList(Console.ReadLine()); } Console.WriteLine("Results are " + myList.GetListAsString()); Console.ReadLine(); }
public bool AddName(ListExercises theListExercises) { if (nextFreeLocation < contents.Length) { contents[nextFreeLocation] = theListExercises; nextFreeLocation = nextFreeLocation + 1; return(true); } else { return(false); } }
public void WhenNis0TheListisEmpty(int n) { var result = ListExercises.MakeFiveList(n); Assert.AreEqual(0, result.Count); }
public void WhenNis95to99TheListHas19Elements(int n) { var result = ListExercises.MakeFiveList(n); Assert.AreEqual(19, result.Count); }
public void WhenNis5to9TheListContains5(int n) { var result = ListExercises.MakeFiveList(n); Assert.AreEqual(5, result[0]); }
public void WhenNis5to9TheListHasOneElement(int n) { var result = ListExercises.MakeFiveList(n); Assert.AreEqual(1, result.Count); }