In an earlier exercise you created and unit tested a generic Catalog class.
Now you are going to make different types of Catalog classes:
Copy your solution to the generic Catalog class to a new Visual Studio solution.
From you Catalog<TId, TElement> class extract and interface. Name the interface ICatalog<TId, TElement>.
Hint: Visual Studio can help you extract the interface: Refactor -> Extract Interface
Rename the Catalog class to CatalogList.
Adapt the unit test class to use the interface in declarations whereever possible in declarations, etc.
Run the test - and check that it has good coverage.
Create a new class CatalogSet<TId, TElement>. This class must implement the interface ICatalog<TId, TElemen>.
The class CatalogSet must use a ISet<TElement> (implemented as a HashSet<TElement) to hold the elements.
Which methods are easier to implement with a Set compared to a List?
Copy and adapt the test from CatalogList.
Make sure the model class (Student or what ever) used in the test has a good GetHashCode() and Equals() method.
Resharper can help you generate the methods: Press Alt + Insert
Run the test - and check that it has good coverage.
Create a class CatalogDictionary<TId, TElement>. This class must implement the interface ICatalog<TId, TElemen>.
The class CatalogDicationary must use a IDictionary<TId, TElement) (implemented as a Dictionary<TId, TElement>) to hold the elements.
Which methods are easier to implement with a Dictionary compared to a List and a Set?
Copy and adapt the test from CatalogList.
Run the test - and check that it has good coverage.