Unit Testing in Visual Studio

This two-day, instructor-led course provides students with the knowledge and skills to effectively use Visual Studio to design, write, and run high-quality .NET unit tests. The course focuses on the applicable features and capabilities of Visual Studio as it relates to unit testing and Test-Driven Development (TDD). This course also introduces other, popular unit testing tools and techniques, and demonstrates how they integrate with Visual Studio and your development lifecycle.

Who Should Attend:
This course is intended for current software development professionals who are involved with building high-quality .NET applications. Students will use Visual Studio while learning how to design, write, and run unit tests. They will also learn many relevant practices and techniques, such as TDD, CI, refactoring, and how to test difficult code.

Prerequisites:
Before attending this course, a student should have experience or familiarity with:

  • The C# language
  • Visual Studio 2017, 2019, or 2022
  • Writing, debugging, and maintaining code
  • Application Lifecycle Management basics
  • Their organization’s development lifecycle
  • Building a high-quality software product
Course Outline

Unit Testing in .NET

  • What is (and isn’t) a unit test
  • Why write unit tests
  • .NET unit testing frameworks
  • MSTest, NUnit, xUnit
  • The anatomy of a unit test
  • Writing and running your first unit test

Unit Testing in Visual Studio

  • Testing support in Visual Studio
  • MSTest, NUnit, and xUnit test projects
  • Test Explorer and other windows
  • Project views (table, board, roadmap)
  • Changing view layout
  • Filtering, grouping, and ordering
  • Creating and using custom fields
  • Crating charts using Insight

Test-Driven Development (TDD)

  • TDD overview and benefits
  • Practicing TDD within Visual Studio
  • Effectively refactoring code
  • Working with legacy code
  • Using CodeLens to support TDD and refactoring

Writing Good Unit Tests

  • Asking questions about your code
  • Path testing (e.g. happy, sad, evil, etc.)
  • Right BICEP testing
  • Testing for expected exceptions
  • Maintaining high-quality test code
  • Unit test naming conventions (e.g. BDD
  • Organizing unit tests

Leveraging Visual Studio

  • Analyzing code coverage
  • Using code coverage as a metric
  • Data-driven (parameterized) unit tests
  • DataRow, DynamicData, and DataSource attributes
  • Concurrent testing using Live Unit Testing
  • Concurrent testing using NCrunch

Testing Difficult Code

  • The need to isolate code under test
  • Doubles (dummies, stubs, fakes, and mocks)
  • Microsoft Fakes framework (stubs and shims)
  • Comparing mocking frameworks
  • Using moq .NET mocking framework
  • Debugging and profiling slow-running unit tests
  • Using IntelliTest with legacy code
Training Course Fee Includes
  • Easy course access: Attend training right from your computer and easily connect your audio via computer or phone. Easy and quick access fits today’s working style and eliminates expensive travel and long days in the classroom.
  • Live, expert instruction: Instructors are sought-after practitioners, highly-experienced in the industry who deliver a professional learning experience in real-time. 
  • Valuable course materials: Courses cover the same professional content as our classroom training, and students have direct access to valuable materials. 
  • Rich virtual learning environment: A variety of tools are built in to the learning platform to engage learners through dynamic delivery and to facilitate a multi-directional flow of information.
  • Hands-on exercises: An essential component to any learning experience is applying what you have learned. Using the latest technology, your instructor can provide hands-on exercises, group activities, and breakout sessions. 
  • Real-time communication: Communicate real-time directly with the instructor. Ask questions, provide comments, and participate in the class discussions.
  • Peer interaction: Networking with peers has always been a valuable part of any classroom training. Live Virtual training gives you the opportunity to interact with and learn from the other attendees during breakout sessions, course lecture, and Q&A.
  • Small class size: Live Virtual courses are limited in small class size to ensure an opportunity for personal interaction.