The ChannelAdam Test Framework Library


This is an open source, .NET Standard 1.3 library that provides the abstract base class foundations for automated testing - designed to make it easier to implement test cases and to read their output.

Below are the main features of the library. See the linked code for details.

Please contact me if you have any questions.

Getting Started

NuGet Package Installation

To install the ChannelAdam.TestFramework NuGet package run the following command in the Package Manager Console:

1PM> Install-Package ChannelAdam.TestFramework


This library is intended for use by other Test Framework implementation libraries that are then to be used by application developers, such as:



Logging useful information to the output of a test is extremely important.

The Simple Logger interface in the ChannelAdam Logging Library provides a very simple Log method that is intended for usage in scenarios such writing test output.

Log and then Assert

I cannot emphasise enough how important it is to log useful to the output of a test. Developers and analysts almost should be able to read the output of a test like a story. Analysts especially should review the test outputs and be satisfied that the test was implemented correctly - almost as if they performed the test themselves. Therefore, when an assertion is performed, we want the test output to actually tell us that an assertion is taking place and provide a information about what is being asserted.

The Log Asserter interface provides all the usual assertion methods that you are familiar with, and the first parameter of all of the methods is a string that will be outputted to an ISimpleLogger (provided in the constructor) before performing the actual assertion. This string is intended to provide the reader of the test output with a human-readable description of what is being asserted, often times just the name of the field/property being asserted, or something more descriptive for say an IsTrue or IsFalse method.

Test Easy Base Class for Tests

Logging, assertions and testing for exceptions are 3 of some fundamental features common to most automated test suites. Wouldn’t it be nice to be able to perform that functionality easily and keep your test code to a minimum?

The TestEasy base class for tests provides those abilities.

This class provides the following helpful properties.

  • ISimpleLogger Logger - for logging to the test output
  • ILogAsserter LogAssert - your handy-dandy log asserter
  • ExpectedExceptionDescriptor ExpectedException - describes the exception that is expected to occur for a specific test case
  • Exception ActualException - for storing the actual exception that occurred

When the ActualException property is set, the details are automatically logged to the test output.

TestEasy also contains the following helpful methods:

  • void Try(Action action) - performs the given action and catches exceptions into ActualException
  • void Try(Func<Task> action) - performs the given asynchronous action that returns a Task, waits for it finish, and catches exceptions into ActualException
  • void AssertNoExceptionOccurred() - asserts that no ActualException exists/occurred
  • void AssertExpectedException(Type expectedExceptionType) - asserts that type of the value of ActualException is the given expected type
  • void AssertExpectedException() - asserts that the ActualException is equivalent to that described by the ExpectedException descriptor.

When the ActualException is an System.AggregateException, the assertion will pass if there is at least one inner exception equivalent to the ExpectedException descriptor.

Expected Exception Descriptor

The ExpectedException property is implemented by the ExpectedExceptionDescriptor class. This class describes the exception that is expected to occur.

There are 2 properties in ExpectedExceptionDescriptor that are specifically used in the AssertExpectedException() method:

  • string MessageShouldContainText - which describes the substring that the ActualException.Message property should contain
  • Type ExpectedType - which describes the System.Type that ActualException should be.

Either or both of these properties can be set. When set, the details are automatically logged to the test output.

Please leave below any comments, feedback or suggestions, or alternatively contact me on a social network.

comments powered by Disqus