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

Classes with more than one responsibility

Ideally, a class should have only one responsibility. When you design your class with more than one responsibility, it is possible to have interactions between responsibilities in the class that will make code modifications difficult and testing the interactions in isolation nearly impossible.

There are indicators that can clearly point out that a class is doing too much and has more than one responsibility. For example, when you are struggling with giving a class a name and you probably end up with the word and in the class name, it's a clue that the class does too much.

Another sign of a class with multiple responsibilities is when the fields in the class are used only in some methods or when the ...

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