Skip to content

Thwaitesy/MSTestHacks

Repository files navigation

Build status

Overview

Just a bunch of hacks to get around the deficiencies of MSTest.

Hopefully for those of us that have to work inside the constrainsts of MSTest, this library should ease our pain. (Just a little)

Check out the tests project for a few samples

Features

Runtime DataSource

A runtime data driven test as opposed to compile time. Just point your datasource to a property, field or method name that returns an IEnumerable and at runtime it will loop through the collection and just act like normal. (Think NUnit's TestCaseSource)

Exception Assert

Provides a much easier way to throw exceptions and verify the type, and information within the exception itself.

Getting Started

Install NuGet. Then, install MSTestHacks from the package manager console:

PM> Install-Package MSTestHacks

###Runtime DataSource Note: App.config or Web.config must be in the project to provide the dynamic linking.

1) You MUST inherit your test class from TestBase

[TestClass]
public class UnitTest1 : TestBase
{ }

2) Create a Property, Field or Method, that returns an IEnumerable

[TestClass]
public class UnitTest1 : TestBase
{
    private IEnumerable<int> Stuff
    {