public void Sort_ByNotExistProperty_ReturnsOriginalCollection(bool isAscending) { // Arrange const string notExistProperty = "notExistProperty"; var utility = new EntitySort(); var originalList = BuildUnsortedList(); // Act var result = utility.Sort(originalList, notExistProperty, isAscending); // Assert result.ShouldBeSameAs(originalList); }
public void Sort_ByExcludedProperty_ReturnsOriginalCollection(bool isAscending) { // Arrange const string propertyToSort = "Id"; var utility = new EntitySort(); utility.ExcludeFromSorting <JustForUnitTest, int>(x => x.Id); var originalList = BuildUnsortedList(); // Act var result = utility.Sort(originalList, propertyToSort, isAscending); // Assert result.ShouldBeSameAs(originalList); }
public void Sort_ByDescending_ReturnsSortedCollection() { // Arrange const bool isAscending = false; const string propertyToSort = "Id"; var utility = new EntitySort(); var originalList = BuildUnsortedList(); var expectedResult = originalList.OrderByDescending(x => x.Id).ToArray(); // Act var result = utility.Sort(originalList, propertyToSort, isAscending).ToArray(); // Assert result.ShouldBeInOrder(SortDirection.Descending, new JustForTestCompare()); }