Object dependency

Our changes to the MailService class have introduced an object dependency. In order for the MailService class to function, it is now dependent on an instance of a class that provides the implementation of the ISystemSettings interface. mailService is therefore dependent on a class that implements the ISystemSettings interface.

This dependency is actually a good thing. It means that we can provide different versions of classes that implement the ISystemSettings interface, without making any changes to our MailService code. This allows us to configure the environment that the MailService class runs within, whether in development, testing, FAT, or production.

It also allows us to test some boundary conditions. In other words, what happens if the SMTP server is not running, or not configured correctly ? Does the MailService class correctly report that an error has occurred? What actions does our code need to take when the service cannot send an email correctly?

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.14.253.221