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.
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:
- It should call the first constructor to initialize the id field.
- It must also initialize the value field for a new Location object.
Open the class file. In this case, the constructors and custom methods are ready. Sally needs you to change the
value fields to auto-implemented properties, but NOT
Open the class file. This time the constructors are done. Sally’s comments direct you to where you need to add the custom methods.
- Code a ToString() method that just returns the
- Use the Generate option again to add the
GetHashCode()methods. Refer to the final section of the “Classes and Objects, Part 2” chapter if you need a quick review.
- Assume that two
PositionTypeobjects are equal when their
Run TestTask2 tests
Uncomment the tests inside the
TestTask2class. Look for the
TODOs to help you find the multi-line comments marks.
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,
push your work up to GitHub.
On to Task 3 .