Chapter 6: Unit Testing

Learning Objectives

After completing this chapter, you should be able to do the following:

  1. Write unit tests to verify the behavior of methods.
  2. Identify proper behaviors for which a test should be written.
  3. Know the importance of testing in creating well-functioning code.
  4. Use test-driven development to define the behavior of code before writing it, and to ensure that code is properly tested.
  5. Using MSTest to create unit tests.

Key Terminology

As you work through this chapter, you should make note of the terms on the following pages:

Testing in C#

  1. Automated Testing
  2. Unit Testing

MSTest

  1. MSTest
  2. Refactor
  3. Test-driven Development
  4. TDD
  5. TestClass
  6. TestMethod
  7. Attributes
  8. Dependency
  9. Test Runner
  10. [TestInitialize]
  11. [TestCleanup]