Book description
Apply the concepts and techniques of Test-Driven Development to building Microsoft .NET–connected applications. Two experts in agile software development demonstrate by example how to use tests to drive lean, efficient coding and better design.
Table of contents
-
Test-Driven Development in Microsoft® .NET
- SPECIAL OFFER: Upgrade this ebook with O’Reilly
- Foreword
- Acknowledgments
- Introduction
-
I. Test-Driven Development Primer
- 1. Test-Driven Development Practices
-
2. Test-Driven Development in .NET—By Example
- The Task
- Test List
-
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 0: Remove Unneeded Code
- Refactoring 1: Rename Method
- Refactoring 2: Add a Test
- 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)
- 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
-
The Sieve
-
II. Test-Driven Development Example
- 4. The Media Library Example
- 5. Programmer Tests: Using TDD with ADO.NET
- 6. Programmer Tests: Using TDD with ASP.NET Web Services
- 7. Customer Tests: Completing the First Feature
- 8. Driving Development with Customer Tests
- 9. Driving Development with Customer Tests: Exposing a Failure Condition
- 10. Programmer Tests: Using Transactions
- 11. Service Layer Refactoring
- 12. Implementing a Web Client
-
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
- Other NUnit Capabilities
- Using the Visual Studio .NET Debugger with NUnit-Gui
-
NUnit Quick Start
- B. Transactions in ADO.NET
- C. Bibliography
- About the Authors
-
A. NUnit Primer
- Index
- SPECIAL OFFER: Upgrade this ebook with O’Reilly
Product information
- Title: Test-Driven Development in Microsoft® .NET
- Author(s):
- Release date: March 2004
- Publisher(s): Microsoft Press
- ISBN: 9780735619487
You might also like
book
ASP.NET Core 3 and React
Build modern, scalable, and cloud-ready single-page applications using ASP.NET Core, React, TypeScript, and Azure Key Features …
book
Microservices in .NET, Second Edition
In Microservices in .NET, Second Edition you will learn how to: Build scalable microservices that are …
book
The Complete ASP.NET Core 3 API Tutorial: Hands-On Building, Testing, and Deploying
Use this ASP.NET Core API tutorial and straightforward step-by-step guide to build, test, and deploy an …
book
Beginning SQL Server 2012 for Developers
Beginning SQL Server 2012 for Developers is the perfect book for developers new to SQL Server …