TDD: Testing with Stub Methods

Please see my other Test Driven Development articles. Adding flexibility to return values using Stub methods. Continuing on my “Testing with Dummy objects” article, you might have noticed a limitation with regards to the return value – only one was allowed. In situations where multiple return values are needed, Stub methods provide an alternative. In…

TDD: Refactoring with Polymorphism

Please see my other Test Driven Development articles. Using polymorphism to refactor SRP violations. Single Responsibility Principle (SRP) violations are one of the most common issues found in code. Either the class or its behavior is attempting to fulfill more than one primary purpose. In this example, I will illustrate how polymorphism provides a powerful…

TDD: Mocking with Dummy Objects

Please see my other Test Driven Development articles. Using custom objects in place of a mocking framework. When it’s desired to avoid the overhead of a mocking framework and its functionality isn’t required, developers may elect to provide their own dummy objects instead. In this article I will illustrate a simple example of writing my…

TDD: Assets

Please see my other Test Driven Development articles. Leveraging overloaded Assert() methods to enhance test methods. Continuing from my TDD: Mocking with Dummy objects article, I wanted to illustrate some examples of other Assert() methods available for use to enhance testing results. As illustrated in my last example, you may just utilize the traditional Assert.AreEqual()…