Home Page Icon
Home Page
Table of Contents for
C. Bibliography
Close
C. Bibliography
by Alexei A. Vorontsov, James W. Newkirk
Test-Driven Development in Microsoft® .NET
Test-Driven Development in Microsoft® .NET
SPECIAL OFFER: Upgrade this ebook with O’Reilly
Foreword
Acknowledgments
Introduction
What Are the Benefits of Using Tests?
An Example
Organization
How to Use This Book
If You Have Never Used NUnit Before
If You Are a Manager or Business Analyst
Small Steps—A Personal Story
Companion Web Site
I. Test-Driven Development Primer
1. Test-Driven Development Practices
What Is Test-Driven Development?
Test Types
Programmer Tests
Customer Tests
Simple Design
Refactoring
Process
Test List
Red/Green/Refactor
Summary
2. Test-Driven Development in .NET—By Example
The Task
Test List
Choosing the First Test
Red/Green/Refactor
Test 1: Create a Stack and verify that IsEmpty is true.
Test 2: Push a single object on the Stack and verify that IsEmpty is false.
Test 3: Push a single object, Pop the object, and verify that IsEmpty is true.
Test 4: Push a single object, remembering what it is; Pop the object, and verify that the two objects are equal.
Test 5: Push three objects, remembering what they are; Pop each one, and verify that they are correct.
Test 6: Pop a Stack that has no elements.
Test 7: Push a single object and then call Top. Verify that IsEmpty returns false.
Test 8: Push a single object, remembering what it is; and then call Top. Verify that the object that is returned is equal to the one that was pushed.
Test 9: Push multiple objects, remembering what they are; call Top, and verify that the last item pushed is equal to the one returned by Top.
Test 10: Push one object and call Top repeatedly, comparing what is returned to what was pushed.
Test 11: Call Top on a Stack that has no elements.
Test 12: Push null onto the Stack and verify that IsEmpty is false.
Test 13: Push null onto the Stack, Pop the Stack, and verify that the value returned is null.
Test 14: Push null onto the Stack, call Top, and verify that the value returned is null.
Summary
3. Refactoring—By Example
The Sieve
Before Refactoring the Code: Make Sure It All Works
Refactoring Cycle
Refactoring 0: Remove Unneeded Code
Refactoring 1: Rename Method
Refactoring 2: Add a Test
When Are We Finished?
Refactoring 3: Hide Method
Refactoring 4: Replace Nested Conditional with Guard Clauses
Refactoring 5: Inline Method
Refactoring 6: Rename Variable
Refactoring 7: Collapse Loops
Refactoring 8: Remove Dead Code
Refactoring 9: Collapse Loops (Again)
We Can Do Some More...
Refactoring 10: Reduce Local Variable Scope
Refactoring 11: Replace Temp with Query
Refactoring 12: Remove Dead Code
Refactoring 13: Extract Method
Refactoring 14: Extract Method (Again)
Refactoring 15: Reduce Local Variable Scope
Refactoring 16: Convert Procedural Design to Objects
Refactoring 17: Keep the Data Close to Where It Is Used
Summary
II. Test-Driven Development Example
4. The Media Library Example
The Skinny
Existing Database
Entities
Entity Relationships
The First Feature
Additional Features
5. Programmer Tests: Using TDD with ADO.NET
Testing the Database Access Layer
The Task
Connecting to the Database
A Small Improvement
We’re Not Finished Yet
Separating the Tests
Individual Entities in Isolation
Defining a Typed DataSet for the Recording Database
Artist Gateway
Primary Key Management
ArtistFixture.cs
Genre Gateway
ConnectionFixture.cs
IdGeneratorFixture.cs
Finishing Up
Testing Relationships Between Entities
Track-Recording Relationship
Retrieve a Recording
Test Organization
Summary
6. Programmer Tests: Using TDD with ASP.NET Web Services
The Task
Test List
Data Transformation
Data Transfer Object
Recording.xsd
Checking the "Title" Field
Building an Assembler
Mapping the Relationships in the Assembler
Database Catalog Service
Web Service Tests
Web Service Producer and Consumer Infrastructure
Web Service Producer
Web Service Consumer
Running the Test
Web Services Security
Almost Done
The Bad News
Summary
Emerging Architecture
7. Customer Tests: Completing the First Feature
Are We Done?
Customer Tests
Customer Tests for Recording Retrieval
Script 1. Retrieve an existing recording and verify its content
Script 2. Retrieve a nonexistent recording
Automating Customer Tests
FIT Overview
Connecting FIT to the Implementation
Automation with FIT
Start Command
Enter Action
Check Action
CatalogAdapter
Running the Script
Continuing with the Automation
Verifying Track Information
Verifying Review Information
Invalid ID Script
Automation Summary
Reconciling Viewpoints
Track Duration
Recording Duration
Summary
8. Driving Development with Customer Tests
The FIT Script
Add a review to an existing recording
Implementing Add/Delete Review
Test List
Changing the Catalog Class
Changing the CatalogService Class
Updating DatabaseCatalogService
Updating CatalogServiceInterface
Fixing AddReviewAdapter
Summary
9. Driving Development with Customer Tests: Exposing a Failure Condition
Programmer Tests
Propagating the Exception
Implementing a SOAP Fault
Summary
10. Programmer Tests: Using Transactions
Programmer Tests
Transaction Manager
Integrating TransactionManager with the Tests and Application Code
Programmer Tests: Catalog Class
Refactoring the Catalog class
Summary
11. Service Layer Refactoring
The Problem
What’s Wrong?
The Solution
Summary
12. Implementing a Web Client
Testing User Interfaces
The Task
Implementing Search
Implementing the Search Service
Implementing the Search Page
Binding the Results to a Repeater Web Control
Creating the Page
Enough of This Stub
Summary
III. Appendixes
A. NUnit Primer
NUnit Quick Start
Step 1. Create Visual Studio Project for your test code.
Step 2. Add a reference to the NUnit Framework.
Step 3. Add a class to the project.
Step 4. Set up your Visual Studio Project to use the NUnit-Gui test runner.
Step 5. Compile and run your test.
Step 6. Become familiar with the NUnit-Gui layout.
NUnit Core Concepts
Test Case
Test Suite
Test Fixture
Tests and Test Fixtures
Working with Test Runners
Assertions
Other NUnit Capabilities
Using SetUp/TearDown Attributes
Using ExpectedException
Using the Ignore Attribute
Using TestFixtureSetUp/TestFixtureTearDown
Test Life-Cycle Contract
Using the Visual Studio .NET Debugger with NUnit-Gui
B. Transactions in ADO.NET
Transaction Management
Manual Transaction Management
Automatic Transaction Management
Transaction Participation
C. Bibliography
Bibliography
About the Authors
Index
SPECIAL OFFER: Upgrade this ebook with O’Reilly
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
Transaction Participation
Next
Next Chapter
Bibliography
Appendix C. Bibliography
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset