public void SearchTermMultiPropsIsNullTest() { try { //test 1 searchterm multiple propertynames var target = new SearchList<HelpItem> { SearchCollection = new List<HelpItem>(_helpItems) }; _propertyNames = new[] { "HelpDescription", "HelpInSource", "HelpTopic", "HelpTopicId", "HelpVersie" }; target.SearchCollection1SearchTermAllProperties(null, _propertyNames); } catch (Exception ex) { Assert.AreEqual(ex.GetType(), typeof(ArgumentNullException)); Assert.AreEqual(ex.Message, Thread.CurrentThread.CurrentCulture.Name == "nl-NL" ? "Search term mag niet null zijn\r\nParameternaam: searchTerm" : "Search term mag niet null zijn\r\nParameter name: searchTerm"); } }
public void SearchCollectionIsNullTest() { var target = new SearchList<HelpItem> { SearchCollection = null }; const string searchTerm = "Help omschrijving 4"; var actual = target.SearchCollection1SearchTerm(searchTerm, PropertyName); Assert.AreEqual(actual, null); actual = target.SearchCollection1SearchTermAllProperties(searchTerm, _propertyNames); Assert.AreEqual(actual, null); const string partialSearchTerm = "speci"; actual = target.SearchCollection1PartialSearchTermAllProperties(partialSearchTerm, _propertyNames); Assert.AreEqual(actual, null); actual = target.SearchCollection1PartialStartSearchTermAllProperties(partialSearchTerm, _propertyNames); Assert.AreEqual(actual, null); }
public void SearchCollection1SearchTermMultiplePropertiesTest() { //Happy flow var searchCollection = new List<HelpItem>(_helpItems); var target = new SearchList<HelpItem>(searchCollection); const string searchTerm = "Help omschrijving 4"; var expected = searchCollection[3]; var actual = target.SearchCollection1SearchTermAllProperties(searchTerm, _propertyNames); Assert.AreEqual(expected, actual[0]); }
public void SearchCollection1SearchTermMultiplePropertiesDuplicateResultTest() { //Happy flow var searchCollection = new List<HelpItem>(_helpItems); searchCollection.Insert(2, searchCollection[3]); var target = new SearchList<HelpItem>(searchCollection); const string searchTerm = "Help omschrijving 4"; var expected = searchCollection.Find(s => s.HelpDescription == searchTerm); _propertyNames[4] = string.Empty; var actual = target.SearchCollection1SearchTermAllProperties(searchTerm, _propertyNames); Assert.IsTrue(actual.Contains(expected)); }
public void PropertyNamesAreNullTest() { var target = new SearchList<HelpItem> { SearchCollection = new List<HelpItem>(_helpItems) }; const string searchTerm = "HelpDescription"; var actual = target.SearchCollection1SearchTermAllProperties(searchTerm, null); Assert.AreEqual(actual, 0); }
public void InvalidCastOnPropertyNamesTest() { //Using a badobject var badCollection = CreateBadObjects(); var badTarget = new SearchList<BadObject>(badCollection); const string searchTerm = "maakt niet uit"; var propertyNames = new[] { "ID", "Name" }; var badActual = badTarget.SearchCollection1SearchTermAllProperties(searchTerm, propertyNames); Assert.IsNull(badActual); }