Hands-on guidance to creating great test-driven development practice Test-driven development (TDD) practice helps developers recog...
CHF29.00
Download steht sofort bereit
Hands-on guidance to creating great test-driven development practice Test-driven development (TDD) practice helps developers recognize a well-designed application, and encourages writing a test before writing the functionality that needs to be implemented. This hands-on guide provides invaluable insight for creating successful test-driven development processes. With source code and examples featured in both C# and .NET, the book walks you through the TDD methodology and shows how it is applied to a real-world application. You’ll witness the application built from scratch and details each step that is involved in the development, as well as any problems that were encountered and the solutions that were applied.
Discusses unit testing and refactoringProfessional Test-Driven Development with C# shows you how to create great TDD processes right away.
Autorentext
James Bender is Vice President of Technology for Improving
Enterprises. He is a Microsoft MVP, working on everything from
small, single-user applications to Enterprise-scale, multi-user
systems.
Jeff McWherter is a Partner and Director of Development
at Gravity Works Design and Development. In 2010 Jeff was awarded
with the Microsoft MVP for the third consecutive year.
Klappentext
Hands-on guidance to creating great test-driven development
practice
Test-driven development (TDD) practice helps developers
recognize a well-designed application, and encourages writing a
test before writing the functionality that needs to be implemented.
This hands-on guide provides invaluable insight for creating
successful test-driven development processes. With source code and
examples featured in both C# and .NET, the book walks you through
the TDD methodology and shows how it is applied to a real-world
application. You'll witness the application built from
scratch and details each step that is involved in the development,
as well as any problems that were encountered and the solutions
that were applied.
Clarifies the motivation behind test-driven development (TDD),
what it is, and how it works
Reviews the various steps involved in developing an application
and the testing that is involved prior to implementing the
functionality
Discusses unit testing and refactoring
Professional Test-Driven Development with C# shows you
how to create great TDD processes right away.
Zusammenfassung
Hands-on guidance to creating great test-driven development practice
Test-driven development (TDD) practice helps developers recognize a well-designed application, and encourages writing a test before writing the functionality that needs to be implemented. This hands-on guide provides invaluable insight for creating successful test-driven development processes. With source code and examples featured in both C# and .NET, the book walks you through the TDD methodology and shows how it is applied to a real-world application. You'll witness the application built from scratch and details each step that is involved in the development, as well as any problems that were encountered and the solutions that were applied.
Discusses unit testing and refactoring
Professional Test-Driven Development with C# shows you how to create great TDD processes right away.
Leseprobe
Im PDF Reader anzeigen...
Inhalt
INTRODUCTION xxv
PART I: GETTING STARTED
CHAPTER 1: THE ROAD TO TEST-DRIVEN DEVELOPMENT 3
The Classical Approach to Software Development 4
A Brief History of Software Engineering 4
From Waterfall to Iterative and Incremental 5
A Quick Introduction to Agile Methodologies 6
A Brief History of Agile Methodologies 6
The Principles and Practices of Test-Driven Development 7
The Concepts Behind TDD 8
TDD as a Design Methodology 8
TDD as a Development Practice 8
The Benefi ts of TDD 9
A Quick Example of the TDD Approach 10
Summary 17
CHAPTER 2: AN INTRODUCTION TO UNIT TESTING 19
What Is a Unit Test? 19
Unit Test Definition 20
What Is Not a Unit Test? 20
Other Types of Tests 22
A Brief Look at NUnit 24
What Is a Unit Test Framework? 24
The Basics of NUnit 25
Decoupling with Mock Objects 28
Why Mocking Is Important 28
Dummy, Fake, Stub, and Mock 29
Best and Worst Practices 35
A Brief Look at Moq 36
What Does a Mocking Framework Do? 36
A Bit About Moq 36
Moq Basics 36
Summary 40
CHAPTER 3: A QUICK REVIEW OF REFACTORING 41
Why Refactor? 42
A Project's Lifecycle 42
Maintainability 43
Code Metrics 43
Clean Code Principles 45
OOP Principles 45
Encapsulation 45
Inheritance 46
Polymorphism 48
The SOLID Principles 49
The Single Responsibility Principle 50
The Open/Close Principle 50
The Liskov Substitution Principle 51
The Interface Segregation Principle 51
The Dependency Inversion Principle 52
Code Smells 52
What Is a Code Smell? 52
Duplicate Code and Similar Classes 53
Big Classes and Big Methods 54
Comments 55
Bad Names 56
Feature Envy 57
Too Much If/Switch 58
Try/Catch Bloat 59
Typical Refactoring 60
Extract Classes or Interfaces 60
Extract Methods 62
Rename Variables, Fields, Methods, and Classes 66
Encapsulate Fields 67
Replace Conditional with Polymorphism 68
Allow Type Inference 71
Summary 71
CHAPTER 4: TEST-DRIVEN DEVELOPMENT: LET THE TESTS BE YOUR GUIDE 73
It Starts with the Test 74
Red, Green, Refactor 76
The Three Phases of TDD 77
The Red Phase 77
The Green Phase 78
The Refactoring Phase 79
Starting Again 79
A Refactoring Example 79
The First Feature 80
Making the First Test Pass 83
The Second Feature 83
Refactoring the Unit Tests 85
The Third Feature 87
Refactoring the Business Code 88
Correcting Refactoring Defects 91
The Fourth Feature 93
Summary 94
CHAPTER 5: MOCKING EXTERNAL RESOURCES 97
The Dependency Injection Pattern 98
Working with a Dependency Injection Framework 99
Abstracting the Data Access Layer 108
Moving the Database Concerns Out of the Business Code 108
Isolating Data with the Repository Pattern 108
Injecting the Repository 109
Mocking the Repository 112
Summary 113
PART II: PUTTING BASICS INTO ACTION
CHAPTER 6: STARTING THE SAMPLE APPLICATION 117
Defi ning the Project 118
Developing the Project Overview 118
Defi ning the Target Environment 119
Choosing the Application Technology 120
Defi ning the User Stories 120
Collecting the Stories 120 Defi ning the Product Backlog 1...