Call us at 1-800-413-0939
Hands On Technology Transfer
gsa

Test Driven Development Training Course .NET

Attend face-to-face, remote-live, on-demand or on site at your facility.

On-Demand Training with Personal Facilitation
Top

Test Driven Development (TDD), and Refactoring Legacy Code Using C#

Delivery Options: Attend face-to-face in the classroom, remote-live or via on-demand training.

Pricing

Face-to-face or remote-live: $2095

On-demand: $1495

Discounts: We offer multiple discount options. Click here for more information.

Duration

Face-to-face or remote-live: 4 Days

On-demand: Approximately 28 hours of coursework with personal facilitation, to be completed in a four week span.

Registration

Face-to-face: Click here to view our schedules and register for in-person sessions.

Remote-live: Click here to register for live remote class sessions within a date range of your choosing.

On-demand: Click here to register for on-demand training with personal facilitation, on a start date of your choosing.

Students Will Learn

  • Agile development and the test-driven development paradigm
  • Creating tests from use cases and/or Agile methodology
  • Unit testing using NUnit and Visual Studio
  • Testing code that interacts with databases
  • Using mocks, fakes, and stubs
  • Automating tests, builds and check-ins using a continuous integration server
  • Refactoring existing code to improve clarity, readability and maintainability
  • Identifying  patterns useful in TDD including the SOLID principles
  • Identifying and eliminating dependencies that make code difficult to maintain and extend
  • Tracking code coverage and analyzing other code metrics to improve code maintainability
  • Using the seam model to identify appropriate places in the code to make changes safely
  • Identifying and correcting various types of code smells
  • Using effect sketches and pinch points to identify optimal places for tests
  • Using feature sketches to identify opportunistic refactoring

Course Description

This course provides students with hands on experience learning Test Driven Development (TDD) using NUnit and Microsoft's Visual Studio. Students build unit tests using mocks, fakes, stubs and drivers, and address issues working with databases and other systems. Students learn how to create tests that assure that code will meet and exceed requirements. The course shows how regression testing assures that code that receives “test coverage” will not break existing systems, because tests are passed before code is checked in.

Students spend time working with the issues involved in refactoring legacy code, safely cutting into an already deployed system. Students are shown how to look for, or create “seams” to more safely improve code or add features, and work on identifying “code smells” that need attention in a productive system. Finally, students will explore dependency issues as well as techniques to better understand and improve complex systems.

Comprehensive C# labs throughout the course provide facilitated hands on practice crucial to developing competence and confidence with the new skills being learned.

Course Prerequisites

C# programming experience and an understanding of object-oriented design principles. HOTT's Learning to Program with C# course or equivalent knowledge provides a solid foundation.

Course Overview

Why TDD? Think Twice, Write Production Code Once
  • Utilizing a Safety Net of Automated Testing
  • Agile Development Concepts
  • Eliminating Bugs Early
  • Smoothing Out Production Rollouts
  • Writing Code Faster via Testing
  • Reducing Technical Debt
  • Practicing Emergent Design
  • Making Changes More Safe
  • The Importance of Regression Testing
Basic Unit Testing
  • NUnit and Visual Studio
  • Adding Complexity to Initial Simple Tests
  • Making Tests Easy to Run
  • The TDD Pattern: Red, Green Refactor
  • Using Methods of the Assert Class
  • Boundary Testing
  • Unit Test Limitations
Comprehensive Unit Testing Concepts
  • Using Declarative-Style Attributes
  • Using Constraints for More Complex Scenarios
  • Using Test Categories
  • Exception Handling in Tests
  • NUnit Test Initialization and Clean Up Methods
  • Writing Clean and Dirty Tests
  • Testing with Collections, Generics and Arrays
  • Negative Testing
Mocks, Fakes, Stubs and Drivers
  • TDD Development Patterns
  • Naming Conventions for Better Code
  • Using Mock Objects
  • Using Fakes
  • Using Stubs
  • Test Doubles
  • Manual Mocking
  • Mocking with a Mock Framework
  • Self-Shunt Pattern
Database Unit Testing
  • Mocking the Data Layer
  • Identifying what Should Be Tested in Databases
  • Stored Procedure Tests
  • Schema Testing
  • Using NDbUnit to Set Up the DB Test Environment
Refactoring Basics
  • Refactoring Existing Code
  • Restructuring
  • Extracting Methods
  • Removing Duplication
  • Reducing Coupling
  • Division of Responsibilities
  • Improving Clarity and Maintainability
  • Test First - then Refactor
  • More Complex Refactoring Considerations
Patterns and Anti-Patterns in TDD
  • The SOLID Principles
  • Factory Methods
  • Coding to Interface References
  • Checking Parameters for Validity Test
  • Open/Closed Principle: Open to Extension, Closed to Change
  • Breaking Out Method/Object
  • Extract and Override Call
  • Extract and Override Factory Method
  • Singleton Pattern
  • Decorator Pattern
  • Facade Pattern
  • State Pattern
  • MVP, MVC and MVVM Patterns
  • Finding and Removing Code Smells/Antipatterns
Refactoring Legacy Code
  • Reducing Risk of Change
    • Eliminating Dependencies
    • Characterization Tests as a Safety Net
    • Introducing Abstractions to Break Dependencies
  • Analyzing Legacy Code
    • Identifying Pinch Points with Effect Analysis
    • Identifying Seams for Expansion and Testing
    • Listing Markup
  • Minimizing Risk of Adding New Behavior
    • Sprout Method
    • Sprout Class
    • Wrap Method
    • Wrap Class
  • Dealing with Code that's Difficult to Test
    • Globals and Singletons in Tests
    • Inaccessible Methods and Fields
  • Using Smells to Identify What to Refactor
    • Dealing with Monster Methods
    • Dealing with Excessively Complex, Large Classes
    • Identifying and Eliminating Duplication
    • Other Smells
  • Dealing with Large Legacy Systems
    • Preserving Signatures
Code Coverage
  • White Box vs Black Box Testing
  • Planning to Increase Code Coverage Over Time
    • Goal 80% or More Test Coverage
    • Statement Coverage
    • Condition Coverage
    • Path Coverage
Risks Changing Legacy/Production Systems
  • Refactoring
  • Coupling and Cohesion Issues
  • Taking Small Tested Steps

Course Benefits

  • Course materials include student guide, hands-on lab manual and USB flash drive for examples and lab work
  • Students receive a certificate of completion at the end of class
  • Students can retake any portion of a live class that has been completed, within 12 months at no extra cost
  • There are no registration fees or cancellation fees

Reviews

I was very pleased with the training offered by HOTT. I am returning to work well-equipped for the projects ahead. Thank you!
— S.Y., EPAUMC


The class was very well done. It was fast-paced and covered a lot of material. It kept me engaged. The instructor was excellent. I would definitely recommend HOTT for future courses.
— S.E., Lambton College

Course Schedule

Choose a city below to view a schedule and registration options. If you have any questions, please call us at 978-250-4299 between 9:00 am - 5:00 pm EST.