ASP.NET Test-Driven Development


Course Number: NET-322

Duration: 5 days (32.5 hours)

Format: Live, hands-on

ASP.NET TDD Training Overview

The ASP.NET Test-Driven Development (TDD) training course covers ASP.NET MVC development and teaches attendees how to unit test both server-side C# code and client-side JavaScript/TypeScript code. Students learn the principles and best practices of TDD and how they are applied in ASP.NET and client-side JavaScript code.

Note: This course can be customized to omit JavaScript or replace JavaScript with TypeScript. In addition, the training can optionally include ASP.NET Blazor and Razor Components unit testing.

Location and Pricing

Accelebrate offers instructor-led enterprise training for groups of 3 or more online or at your site. Most Accelebrate classes can be flexibly scheduled for your group, including delivery in half-day segments across a week or set of weeks. To receive a customized proposal and price quote for private corporate training on-site or online, please contact us.

In addition, some Microsoft courses are available as live, online classes for individuals.

Objectives

  • Learn the principle and best practices of Test-Driven Development
  • Apply TDD in ASP.NET and JavaScript/TypeScript code
  • Explore the parts of unit testing and E2E testing
  • Practice how to organize unit tests
  • Understand what needs to be tested for different parts of the application
  • Enable testing in isolation with mocks, stubs, and fakes
  • Integrate testing into local development tools and CICD pipelines (Azure DevOps or GitHub)

Prerequisites

  • Experience with C# and ASP.NET technologies
  • Experience with JavaScript or TypeScript

Outline

Expand All | Collapse All

Introduction
  • What is Test-Driven Development?
  • Benefits of TDD
  • Challenges of TDD
Principles of TDD (inspired by “Uncle” Bob Martin)
  • Three Laws of TDD
  • Clean Tests
  • One Assert Per Test
  • Five Rules: FIRST
    • Fast
    • Independent
    • Repeatable
    • Self-Validating
    • Timely
  • Red, Green, Refactor Technique
Kinds of Testing
  • Unit Tests
  • Integration Tests
  • E2E Testing
  • Automated vs. Manual Testing
  • Testing & DevOps
Testing Parts
  • Tests
  • Test Suites
  • Assertions
  • Setup/Teardown
  • Mocks, Fakes, Stubs
  • Arrange, Act, Assert
  • Test Frameworks
  • Test Runners
  • Code Coverage
Overview of .NET Core and Testing
  • Testing Frameworks
    • MSTest
    • NUnit
    • XUnit
  • Test Runners
    • Command-Line
    • Visual Studio
    • Visual Studio Code
  • Testing Libraries
    • Mocking with Moq
    • Fluent Assertions
    • BUnit (for classes using Blazor)
xUnit
  • What is xUnit?
  • Testing Framework
  • Test Parallelism
  • Shared Test Context
  • Facts vs. Theory
  • Assertions
  • Integration with Visual Studio
  • Debugging Unit Tests in Visual Studio
  • Debugging Unit Tests in Visual Studio Code
ASP.NET MVC Test-Driven Development (focus is on testing REST APIs)
  • What Should be Tested on an MVC application?
  • Integrate Test Projects into a Solution
  • Testing Controllers
  • Testing APIs
  • Integration Testing of APIs
ASP.NET Blazor Test-Driven Development
  • What Should be Tested on a Razor Component?
  • What is bUnit?
  • Using bUnit with xUnit
  • Setup and define components under tests in C# or Razor syntax
  • Verify outcome using semantic HTML comparer
  • Interact with and inspect components
  • Trigger event handlers
  • Provide cascading values
  • Inject services
  • Mock IJsRuntime
  • Perform snapshot testing
Mocking Databases (choose 1)
  • Entity Framework
  • Dapper
JavaScript Test-Driven Development
  • Is JavaScript Unit Testing a Thing?
  • Benefits of Unit Testing JavaScript
  • Challenges of Unit Testing JavaScript
JavaScript Testing Frameworks Overview
  • Jest
  • Jasmine
  • Mocha
JavaScript Test Runners Overview
  • Jest
  • Karma
JavaScript E2E Testing Overview
  • What is End-To-End Testing?
  • Selenium WebDriver
  • Cypress
JavaScript TDD with BDD
  • What is Behavior-Driven Development?
  • Coding Unit Tests around Behavior vs Functions
  • Given-When-Then
JavaScript Unit Testing (with Jest or Jasmine)
  • Test Suites
  • Tests
  • Assertions
  • Mocks and Spies
JavaScript E2E Testing (with Selenium or Cypress)
  • Finding Elements in the DOM Tree
  • Page Objects
Testing JavaScript Code Frameworks (select one)
  • Plain Vanilla JavaScript (with Jest or Jasmine)
    • Configure Unit Testing for a JavaScript/TypeScript project
    • Organize Code for Efficient Testing
    • Mocking the DOM
    • Testing DOM Manipulation Code
    • Testing AJAX Code
    • Running Tests
    • Debugging Tests
  • React (must use Jest)
    • What needs to be tested?
    • Testing with Jest
    • Testing with Testing Library
    • Testing Components
    • Component Snapshot Tests
    • Using Spies for Event Handlers
    • Mocking Components
    • Testing Custom Hooks
    • Organize React Code for Better Unit Testing
  • Angular (with Jest or Jasmine)
    • What needs to be tested?
    • How are the different parts of Angular tested?
    • Angular Testing Terminology: TestBed, ComponentFixture, debugElement, async, fakeAsync, tick, inject
    • Simple Component Test
    • Detecting Component Changes
    • Testing a Component with properties (inputs) and events (outputs)
    • Testing a Component that uses the Router
    • Testing a Component that depends on a Service
    • Testing a Service and Mocking its HTTP requests
    • Testing a Pipe
    • End-To-End Testing with a project generated by the Angular CLI
Code Coverage
  • What is Code Coverage?
  • What can be understood from Code Coverage?
  • What are the limitations of Code Coverage?
  • Generate Code Coverage reports for ASP.NET C# code
  • Generate Code Coverage reports for JavaScript code
  • Integrate code coverage into CICD systems (Azure DevOps or GitHub Actions)
Conclusion

Training Materials

All ASP.NET Test-Driven Development training course attendees receive comprehensive courseware.

Software Requirements

  • Visual Studio 2022, Visual Studio Code, or JetBrains Rider
  • Windows, macOS, or Linux
  • .NET 6.0 SDK
  • Node.js (latest LTS version)
  • Ability to download NuGet and NPM packages
  • LocalDB or SQL Server
  • On request, Accelebrate can provide a remote environment with all these items to which attendees can connect using Remote Desktop Connection or a browser


Learn faster

Our live, instructor-led lectures are far more effective than pre-recorded classes

Satisfaction guarantee

If your team is not 100% satisfied with your training, we do what's necessary to make it right

Learn online from anywhere

Whether you are at home or in the office, we make learning interactive and engaging

Multiple Payment Options

We accept check, ACH/EFT, major credit cards, and most purchase orders



Recent Training Locations

Alabama

Birmingham

Huntsville

Montgomery

Alaska

Anchorage

Arizona

Phoenix

Tucson

Arkansas

Fayetteville

Little Rock

California

Los Angeles

Oakland

Orange County

Sacramento

San Diego

San Francisco

San Jose

Colorado

Boulder

Colorado Springs

Denver

Connecticut

Hartford

DC

Washington

Florida

Fort Lauderdale

Jacksonville

Miami

Orlando

Tampa

Georgia

Atlanta

Augusta

Savannah

Hawaii

Honolulu

Idaho

Boise

Illinois

Chicago

Indiana

Indianapolis

Iowa

Cedar Rapids

Des Moines

Kansas

Wichita

Kentucky

Lexington

Louisville

Louisiana

New Orleans

Maine

Portland

Maryland

Annapolis

Baltimore

Frederick

Hagerstown

Massachusetts

Boston

Cambridge

Springfield

Michigan

Ann Arbor

Detroit

Grand Rapids

Minnesota

Minneapolis

Saint Paul

Mississippi

Jackson

Missouri

Kansas City

St. Louis

Nebraska

Lincoln

Omaha

Nevada

Las Vegas

Reno

New Jersey

Princeton

New Mexico

Albuquerque

New York

Albany

Buffalo

New York City

White Plains

North Carolina

Charlotte

Durham

Raleigh

Ohio

Akron

Canton

Cincinnati

Cleveland

Columbus

Dayton

Oklahoma

Oklahoma City

Tulsa

Oregon

Portland

Pennsylvania

Philadelphia

Pittsburgh

Rhode Island

Providence

South Carolina

Charleston

Columbia

Greenville

Tennessee

Knoxville

Memphis

Nashville

Texas

Austin

Dallas

El Paso

Houston

San Antonio

Utah

Salt Lake City

Virginia

Alexandria

Arlington

Norfolk

Richmond

Washington

Seattle

Tacoma

West Virginia

Charleston

Wisconsin

Madison

Milwaukee

Alberta

Calgary

Edmonton

British Columbia

Vancouver

Manitoba

Winnipeg

Nova Scotia

Halifax

Ontario

Ottawa

Toronto

Quebec

Montreal

Puerto Rico

San Juan