public void TestWorkWithEmptyFilter(IEnumerable <StudentTestResult> expected) { Sorter <StudentTestResult> sorter = new Sorter <StudentTestResult>(); IEnumerable <StudentTestResult> actual = sorter.ApplySort(expected); Assert.AreEqual(expected, actual); }
public void TestWorkWithEmptyCollection(IEnumerable <StudentTestResult> testResults) { Sorter <StudentTestResult> Sorter = new Sorter <StudentTestResult>(); void TryApplySorter() { IEnumerable <StudentTestResult> result = Sorter.ApplySort(testResults); } Assert.Throws(typeof(InvalidOperationException), TryApplySorter); }
public void TestWorkWithNullCollection(IEnumerable <StudentTestResult> testResults) { Sorter <StudentTestResult> Sorter = new Sorter <StudentTestResult>(); void TryApplySorter() { IEnumerable <StudentTestResult> result = Sorter.ApplySort(testResults); } Assert.Throws(typeof(ArgumentNullException), TryApplySorter); }
public void TestAndSortByAsc_TProperty(IEnumerable <StudentTestResult> testResults) { Sorter <StudentTestResult> sorter = new Sorter <StudentTestResult>(); const string propertyName = "Score"; IEnumerable <StudentTestResult> expected = testResults .OrderBy(test => test.Score).ToArray(); sorter.AndSortByAsc <byte>(propertyName); IEnumerable <StudentTestResult> actual = sorter.ApplySort(testResults).ToArray(); Assert.AreEqual(expected, actual); }
private void ApplyExistingConditions() { IEnumerable<StudentTestResult> buffer = new List<StudentTestResult>(filter.ApplyFilterSettings(studentTestResults)); buffer = sorter.ApplySort(buffer); if (checkBoxOnlyTake.Checked) { buffer = buffer.Take((int)numericUpDown1.Value); } visibleStudentsTestsResults = new List<StudentTestResult>(buffer); }
public void TestDoubleSortByAsc(IEnumerable <StudentTestResult> testResults) { Sorter <StudentTestResult> sorter = new Sorter <StudentTestResult>(); const string propertyName = "Score"; const string propertyNameArgument = "FirstName"; Type typeOfArgument = typeof(string); IEnumerable <StudentTestResult> expected = testResults .OrderBy(test => test.Score).ThenBy(item => item.FirstName).ToArray(); sorter.AndSortByAsc <byte>(propertyName); sorter.AndSortByAsc(propertyNameArgument, typeOfArgument); IEnumerable <StudentTestResult> actual = sorter.ApplySort(testResults).ToArray(); Assert.AreEqual(expected, actual); }