Unit Testing in Visual Studio 2013

מק"ט: #5457 | משך קורס: 16 שעות אק'

This two-day instructor-led course provides students with the knowledge and skills to effectively use Visual Studio 2013 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.

הקורס פעיל לקבוצות מטעם ארגונים בלבד, ניתן לשלוח פנייה רק אם מדובר בקבוצה
*שדות חובה
PDF version


This course teaches students how to effectively design, write, and run high-quality unit tests using Visual Studio. At course completion, attendees will have had exposure to:

  • Why unit tests are critical to software quality
  • How to effectively refactor within TDD
  • How unit tests and integration tests differ
  • Why and how to refactor legacy code
  • Popular unit testing frameworks
  • Happy path vs. sad path testing
  • The anatomy of a unit test
  • Testing boundary conditions
  • The 3A pattern (Arrange, Act, Assert)
  • Organizing tests and test assemblies
  • Assertions and expected exceptions
  • Behavior-Driven Development principles
  • Test class inheritance
  • How to use data-driven unit tests
  • Testing private methods
  • Why and how to calculate code coverage
  • Visual Studio 2013 test projects
  • Why and how to use test impact analysis
  • Visual Studio 2013 test windows and tools
  • Team Foundation Server support for testing
  • How basic and standard unit tests differ
  • Team Foundation Build support for testing
  • How and when to use categories and lists
  • Why and how to use continuous integration
  • How and when to use ordered tests
  • Using dummies, fakes, stubs, and mocks
  • Running tests and managing test results
  • Why and how to use Microsoft Fakes
  • The importance of Test-Driven Development
  • Why and how to use Rhino Mocks
  • Implementing TDD in Visual Studio 2013
  • Why and how to use Microsoft Pex

קהל יעד

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.

תנאי קדם

Before attending this course, students should have experience or familiarity with:

  • Building a high-quality software product
  • Visual Studio 2010, 2012 or 2013
  • Writing, debugging, and maintaining code
  • Their organization’s development lifecycle
  • The Visual C# language


This module introduces the concepts of unit testing and how it is supported by various unit testing frameworks and tools for .NET, including MSTest and NUnit. The anatomy of a unit test is also detailed in this module.

  • The role of the developer
  • Unit tests explained
  • .NET unit testing frameworks (MSTest.exe and others)
  • Writing unit tests


This module introduces Visual Studio test projects, the testing windows, and the functionality for effectively writing and running unit tests and managing test results.

  • Testing support in Visual Studio
  • Test projects
  • Test Explorer and other windows
  • Unit testing in Visual Studio
  • Managing a large number of tests
  • Running tests
  • Managing test results


This module introduces Test Driven Development (TDD) and the business case for why you should practice it. Refactoring as well as a discussion of how to work with legacy code are also a part of this module.

  • TDD overview, benefits, and common objections
  • Implementing TDD in Visual Studio
  • Refactoring
  • Legacy Code


Just knowing how to write unit tests and being disciplined in TDD is not enough. This module will demonstrate several other practices for ensuring that you write high-quality unit tests.

  • Know your code
  • Path testing (i.e. sad path)
  • Right BICEP
  • Testing for expected exceptions
  • Maintaining high-quality test code
  • Behavior-Driven Development (BDD)
  • BDD naming conventions
  • Organizing test libraries (assemblies)


This module examines additional unit testing features found in Visual Studio, including code coverage, data-driven unit tests, and test impact analysis. In addition, many unit-testing specific features in Team Foundation Server and Team Foundation Build will be part of the discussion.

  • Code coverage
  • Data-driven unit tests
  • Test impact analysis
  • Team Foundation Server
  • Testing check-in policy
  • Team Foundation Build
  • Build verification tests (BVTs)
  • Gated check-ins
  • Continuous Integration (CI)


This module introduces some tools and techniques for testing difficult code, such as code that can’t be tested without being hosted in another environment (i.e.ASP.NET, SharePoint, etc.)

  • The need to isolate code under test
  • Doubles (dummies, stubs, fakes, and mocks)
  • Mocking frameworks (Rhino Mocks)
  • Fakes framework (Ultimate edition)
  • Microsoft Code Digger