Skip to Content
C# and .NET Core Test-Driven Development
book

C# and .NET Core Test-Driven Development

by Ayobami Adewole
May 2018
Intermediate to advanced content levelIntermediate to advanced
300 pages
7h 35m
English
Packt Publishing
Content preview from C# and .NET Core Test-Driven Development

Monster Constructor

To test a method, you have to instantiate or construct the class containing the method. The most common mistake developers make is to create what I call Monster Constructor, which is simply a constructor that does too much work or real work, such as performing I/O operations, database calls, static initialization, reading some large files, or establishing communication with external services.

When you have a class designed with a constructor that initializes or instantiates objects other than value objects (list, array, and dictionary), the class technically has a nonflexible structure. This is a bad class design because the class automatically becomes strongly tied to the classes it is instantiating, making unit testing ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On Design Patterns with C# and .NET Core

Hands-On Design Patterns with C# and .NET Core

Gaurav Aroraa, Jeffrey Chilberto
.NET Core in Action

.NET Core in Action

Dustin Metzgar

Publisher Resources

ISBN: 9781788292481Supplemental Content