Task 2: Complete the Support Classes


Due to the fact that this code is being auto-graded as you work through it, make sure that you use any and all names for classes, variables, methods, etc provided to you in these directions.

Sally needs you to build up the remaining classes. In each case, refer to the Employer class for hints on how to structure your code.

The Location Class

Open the Location.cs file. Note that the methods for this class are done, as is the constructor for initializing the Id property.

Sally left you a TODO comment with instructions for coding a second constructor:

  1. It should call the first constructor to initialize the id field.
  2. It must also initialize the value field for a new Location object.

To locate all of the TODOs for Task 2, use the Task List feature in Visual Studio.

Windows Users : To open Task List, select View > Task List

Mac Users : To open Task List, select View > Tasks

The CoreCompetency Class

Open the class file. In this case, the constructors and custom methods are ready. Sally needs you to change the id and value fields to auto-implemented properties, but NOT nextId.

The PositionType Class

Open the class file. This time the constructors are done. Sally’s comments direct you to where you need to add the custom methods.

  1. Code a ToString() method that just returns the value of a PositionType object.
  2. Use the Generate option again to add the Equals() and GetHashCode() methods. Refer to the final section of the “Classes and Objects, Part 2” chapter if you need a quick review.
  3. Assume that two PositionType objects are equal when their id fields match.

Run TestTask2 tests

Uncomment the tests inside the TestTask2class. Look for the TODOs to help you find the multi-line comments marks.

Run your TestTask2 unit tests.

Refactor your code as needed.

Do not start Task 3 until you have passed all of Task 2’s auto-grading unit tests.


Now would be a good time to save, commit, and push your work up to GitHub.

On to Task 3 .