public void GetQueriesFromListByName_Test() { // Arrange string select = "select"; string person = "person"; List <SqlQuery> allQueries = queriesDbSet.ToList(); int QueriesWithWordSelectAmount = 0; int QueriesWithWordPersonAmount = 0; foreach (SqlQuery query in queriesDbSet) { if (query.SqlQueryName.Contains(select)) { QueriesWithWordSelectAmount++; } if (query.SqlQueryName.Contains(person)) { QueriesWithWordPersonAmount++; } } // Act IEnumerable <SqlQuery> queryNameContainsSelect = queryRepo .GetQueriesFromListByName(allQueries, select); IEnumerable <SqlQuery> queryNameContainsPerson = queryRepo .GetQueriesFromListByName(allQueries, person); // Assert Assert.AreEqual( QueriesWithWordSelectAmount, queryNameContainsSelect.Count() ); Assert.AreEqual( QueriesWithWordPersonAmount, queryNameContainsPerson.Count() ); foreach (SqlQuery query in queryNameContainsSelect) { Assert.IsTrue(query.SqlQueryName.Contains(select)); } foreach (SqlQuery query in queryNameContainsPerson) { Assert.IsTrue(query.SqlQueryName.Contains(person)); } }