public void TestDoubleSortByDesc(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 .OrderByDescending(test => test.Score).ThenByDescending(item => item.FirstName).ToArray(); sorter.AndSortByDesc <byte>(propertyName); sorter.AndSortByDesc(propertyNameArgument, typeOfArgument); IEnumerable <StudentTestResult> actual = sorter.ApplySort(testResults).ToArray(); Assert.AreEqual(expected, actual); }
private void ConstructFirstSortingInfo() { if (radioButtonAsc.Checked) { if (comboBox1.Text == "Score") { sorter.AndSortByAsc(comboBox1.Text, typeof(int)); } if (comboBox1.Text == "TestDate") { sorter.AndSortByAsc(comboBox1.Text, typeof(DateTime)); } else { sorter.AndSortByAsc(comboBox1.Text, typeof(string)); } } if (radioButtonDesc.Checked) { if (comboBox1.Text == "Score") { sorter.AndSortByDesc(comboBox1.Text, typeof(int)); } if (comboBox1.Text == "TestDate") { sorter.AndSortByDesc(comboBox1.Text, typeof(DateTime)); } else { sorter.AndSortByDesc(comboBox1.Text, typeof(string)); } } }