public void CheckFilterByStudentAnd5rows() { List <TestResult> expectedList = new List <TestResult>(); List <TestResult> testingList = new List <TestResult>(); expectedList.Add(new TestResult("Dva Dva Dva", "Test na end", DateTime.Parse("06.08.2019 0:00:00"), 77)); expectedList.Add(new TestResult("qqqqqq", "Test na luck", DateTime.Parse("06.11.2019 19:12:39"), 0)); expectedList.Add(new TestResult("Quack", "Test na agi", DateTime.Parse("31.12.9999 23:59:59"), 111)); expectedList.Add(new TestResult("RazRaz", "Test na per", DateTime.Parse("22.10.2019 0:00:00"), 66)); expectedList.Add(new TestResult("Tri", "Test na cha", DateTime.Parse("06.11.2014 0:00:00"), 88)); testing.GetResultsFromFile(file); testing.SetKindOfSort((int)ResultChecker.KindOfSort.ByNameOfStudent); testing.SetCountOfVisibleRows(5); foreach (var item in testing.GetEnumeratorByDirectionOfSort().Where(x => x.ToString().Contains(testing.Contains)).Take(testing.CountOfVisibleRows)) { testingList.Add(item); } CollectionAssert.AreEqual(expectedList, testingList); }