score:2
Accepted answer
You need to unit-test the second method just to make sure it works. If you refactor something that changes how it works and fix the first one, how will you know if you forgot to fix the second one? If you refactor WithOrdering
, how will you know that things still work? I would have a unit test to test ascending and one to test descending.
Source: stackoverflow.com
Related Articles
- Compiling Error with LINQ Sorting Code Using List<T>
- I need to save the XML file using linq with xml code in C#
- Need to insert a string if array returns empty using linq queries
- Simplify the following code to a one-liner using Linq queries
- Getting InvalidCastException when trying to implement sorting in Entity Framework Code First using Linq
- Convert string[] to int[] in one line of code using LINQ
- How are people unit testing code that uses Linq to SQL
- Alphanumeric sorting using LINQ
- Unit test error : This function can only be invoked from LINQ to Entities
- Topological Sorting using LINQ
- Get new indices of items in a collection after sorting using LINQ
- Is it possible to accelerate (dynamic) LINQ queries using GPU?
- If it's bad to use inline SQL, how does using LINQ to perform queries differ in practice?
- Need to debug LINQ simple queries in Visual Studio 2010
- Using expressions in the "Select" part of LINQ to entities queries
- Need help in a grouping using LINQ in C#
- Left outer join using LINQ -- understanding the code
- How to reuse a linq expression for 'Where' when using multiple source tables
- Good way to time SQL queries when using Linq to SQL
- Avoiding code repetition when using LINQ
- Using LINQ to delete an element from a ObservableCollection Source
- LINQ Source Code Available
- Should I be using LINQ queries on RavenDB?
- C# Sorting Directory Names using LINQ
- LINQ Sorting - First three need to be different manufacturers
- How to write LINQ Queries for CRUD using Entity Framework?
- How can I write the following code more elegantly using LINQ query syntax?
- How to construct IQueryable query using Linq when I just need count without reading all documents in Document-Db database?
- How can I code an outer join using LINQ and EF6?
- how do i build dynamic linq queries at runtime using strings?
- summarize values on a tree
- how to perform a bulk update with a list of objects linq c#
- Find value of attribute when value of sibling is known only
- LINQ to return list of Object filtered on a property of a Child object in nested List<>
- Looking for non-matched items in a collection via Linq
- Linq Comparing Two Lists and Generating a New One
- one query with groupby / count / select new
- How do I Sort/OrderBy IList<Int32>
- Converting IQueryable string to compare against string
- Why is IEnumerable.Count() reevaluating the query?
- Remove Listbox Items With Checkboxes
- How do i get the difference in two lists in C#?
- How to retreive a field from JSON string stored in database
- Sequence contains no elements?
- LINQ - "Index was outside the bounds of the array."
- Convert Sql Query To linq using sum with group by
- Gridview always add new row when click button?
- Filter a Generic list using LINQ using a PropertyName as a string literal - Using dynamics
- Manipulating existing XDocument (fails)
- Linq to get distinct subdirectories from list of paths