public void RemoveFromList_Where_OriginalList_Is_Null_Returns_Empty() { Collection <string> listToRemove = new Collection <string>() { "Bar", "Nar" }; List <string> filteredList = new List <string>(ListLibrary.RemoveFromList(listToRemove, null)); Assert.IsEmpty(filteredList); }
public void RemoveFromList_Where_ListToRemove_Is_Null_Returns_OriginalList() { Collection <string> originalList = new Collection <string>() { "Foo", "Bar", "Moo", "Nar" }; List <string> filteredList = new List <string>(ListLibrary.RemoveFromList(null, originalList)); Assert.IsTrue(originalList.Count == filteredList.Count); Assert.AreEqual(originalList[0], filteredList[0]); Assert.AreEqual(originalList[1], filteredList[1]); Assert.AreEqual(originalList[2], filteredList[2]); Assert.AreEqual(originalList[3], filteredList[3]); }
public void RemoveFromList_Where_All_Original_Items_Removed_Returns_Empty() { Collection <string> listToRemove = new Collection <string>() { "Foo", "Bar", "Moo", "Nar" }; Collection <string> originalList = new Collection <string>() { "Foo", "Bar", "Moo", "Nar" }; List <string> filteredList = new List <string>(ListLibrary.RemoveFromList(listToRemove, originalList)); Assert.IsEmpty(filteredList); }
public void RemoveFromList_Where_No_Items_To_Remove_Found_Returns_OriginalList() { Collection <string> listToRemove = new Collection <string>() { "Fie", "Fei" }; Collection <string> originalList = new Collection <string>() { "Foo", "Bar", "Moo", "Nar" }; List <string> filteredList = new List <string>(ListLibrary.RemoveFromList(listToRemove, originalList)); Assert.IsTrue(originalList.Count == filteredList.Count); Assert.AreEqual(originalList[0], filteredList[0]); Assert.AreEqual(originalList[1], filteredList[1]); Assert.AreEqual(originalList[2], filteredList[2]); Assert.AreEqual(originalList[3], filteredList[3]); }
public void RemoveFromList_Where_Case_Ignored_Removes_Differing_Cases_Of_Same_Items() { Collection <string> listToRemove = new Collection <string>() { "bar", "Nar", "Fei", "Fie" }; Collection <string> originalList = new Collection <string>() { "Foo", "Bar", "Moo", "Nar" }; List <string> expectedResults = new List <string>() { "Foo", "Moo" }; List <string> filteredList = new List <string>(ListLibrary.RemoveFromList(listToRemove, originalList, caseSensitive: false)); Assert.IsTrue(originalList.Count > filteredList.Count); Assert.AreEqual(expectedResults[0], filteredList[0]); Assert.AreEqual(expectedResults[1], filteredList[1]); }
public void RemoveFromList_Removes_Matching_Items_From_List() { Collection <string> listToRemove = new Collection <string>() { "Bar", "Nar", "Fei", "Fie" }; Collection <string> originalList = new Collection <string>() { "Foo", "Bar", "Moo", "Nar" }; List <string> expectedResults = new List <string>() { "Foo", "Moo" }; List <string> filteredList = new List <string>(ListLibrary.RemoveFromList(listToRemove, originalList)); Assert.IsTrue(originalList.Count > filteredList.Count); Assert.AreEqual(expectedResults[0], filteredList[0]); Assert.AreEqual(expectedResults[1], filteredList[1]); }
public void RemoveFromList_Where_Both_Lists_Are_Null_Returns_Empty() { List <string> filteredList = new List <string>(ListLibrary.RemoveFromList(null, null)); Assert.IsEmpty(filteredList); }