Test-Driven Development in .NET Core - The Handbook

Video description

Test-Driven Development (TDD) is a powerful approach to build solid and robust software. In this course, you will learn the skills you need in order to be able to apply TDD in your .NET projects. Unit testing is a type of software testing where code is written to automate the testing of sub-sections of an entire application.

This course starts with an introduction to the course and moves on to explain how to use .NET 6 and 7. You will learn to code a booking service as well as to test and implement the application. Moving further, you will learn about integration testing and learn how to retrieve available rooms from the application. You will also understand unit testing and implement code for unit tests. In the final section of the course, you will learn to set up a GitHub account and add projects to GitHub. You will also get the hang of Git branching and pull requests on GitHub.

After this course, you will have a foundational knowledge of test-driven development that will help you as you move forward to test and implement new features in your C# projects. You will have the skills and knowledge of creating a testable and maintainable ASP.NET core application needed to architect real-world, enterprise .NET core apps.

What You Will Learn

  • Learn unit testing - testing core application code
  • Learn integration testing - testing third-library interactions (such as EF core)
  • Explore test-driven development - red-green-refactor cycle
  • Learn how to use facts and theories to write tests
  • Explore how to write testable code
  • Understand good unit testing patterns and practices

Audience

To take this course, you will need to have some knowledge of .NET core development and C#. This course can be taken by any developer at all levels and anyone who wants a better understanding of how unit tests help you write better code.

About The Author

Trevoir Williams: Trevoir Williams is a software engineer and part-time lecturer. With a master’s degree in computer science, he has spent over a decade teaching web, software, and database development courses. He also has extensive industry experience in web application development, Azure Cloud system, and server administration.

He enjoys teaching IT and development courses and hopes to impart knowledge of the latest developments in industry standards and techniques to his students.

Table of contents

  1. Chapter 1 : Introduction
    1. Course Introduction
  2. Chapter 2 : Getting Started with Test-Driven Development
    1. Using .NET 6/7
    2. Create Test Project
    3. Unit Test: Create Unit Test Based on Requirement
    4. Implement: Write Code to Return Correct Data
    5. Refactor: Test and Implementation Code
  3. Chapter 3 : Unit Testing – Application Core
    1. Review Full Requirement List with GitHub Projects
    2. Test and Implement: Throw Exception When Request Is Null
    3. Create Booking Services
    4. Unit Test: Save a Room Booking
    5. Implement: Save a Room Booking
    6. Unit Test: Check Whether Room Is Available
    7. Implement: Check Whether Room Is Available
    8. Test and Implement: Add Room ID to Result
    9. Test and Implement: Return Successful or Failed Booking Result
    10. Test and Implement: Add Booking ID to Result
    11. Section Review
  4. Chapter 4 : Integration Testing – Testing the Data Access Layer
    1. Refactor Project for Data Access Layer
    2. Unit Test: Retrieve Available Rooms
    3. Implement: Retrieve Available Rooms
    4. Test and Implement: Save a Room Booking
    5. Section Review
  5. Chapter 5 : Application Testing – Unit Testing ASP.NET Core (UI) Application
    1. Understanding Unit Testing .NET Core Applications
    2. Set Up SQLite In-Memory Data Store
    3. Create Unit Test Scenarios
    4. Implement Code for Tests
    5. Run and Test ASP.NET Core Application
  6. Chapter 6 : Using GitHub for Continuous Integration and Testing
    1. Section Overview
    2. Set Up GitHub Account
    3. Add Project to GitHub
    4. Protect Main/Master Branch
    5. Git Branching and Pull Requests
    6. Create GitHub Build Action
    7. Finalizing Continuous Integration Action
    8. Section Review
  7. Chapter 7 : Conclusion
    1. Course Review

Product information

  • Title: Test-Driven Development in .NET Core - The Handbook
  • Author(s): Trevoir Williams
  • Release date: March 2023
  • Publisher(s): Packt Publishing
  • ISBN: 9781803246024