11 Runtime type checking revisited and error handling

This chapter covers

  • Using the Assert.IsInstanceOfType test assertion
  • Calling multiple repositories from a service class
  • Using the discard operator
  • Using multiple catch blocks
  • Checking types at runtime with the is and as operators

After having implemented the database access layer in chapter 5 and the repository layer in chapters 6 through 9, we started to implement the BookingService in chapter 10. I also introduced you to using mocks in unit testing, and we discussed the repository/service pattern. In this chapter, we’ll use those concepts and draw on our knowledge of service layers to wrap up the BookingService implementation. Figure 11.1 shows where we are in the scheme of the book. ...

Get Code like a Pro in C# now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.