Skip to content

hylasoft-usa/h-behavior

Repository files navigation

h-behavior Build status NuGet Status

Behavior Driven Development (BDD) wrapper for .NET MsTests

Requirements

h-dependency works with .NET Framework 4.5 and higher

Usage

To use it, make your unit test class inherit from Hylasoft.Behavior.Spec:

[TestClass]
public class TestBehavior : Spec{

  //Your tests here

}

In your tests, instead of using Assert use the Expect().To... Syntax:

Expect(myBooleanValue).ToBeTrue();
Expect(myString).ToBe("qwertyuiop");
Expect(myInteger).ToNotBeInstanceOf(typeof(string));
Expect<Action>(MyFaultyMethod).ToThrowException<TypeLoadException>();

The following extensions are available if you include the namespace Hylasoft.Behavior.Extensions:

  • Exceptions
  • Enumerables and Collections
  • Comparable
  • Booleans

Build

You can build the project using Visual Studio or by running the grunt tasks for msbuild

Contribute

This project uses hylasoft/cs-boilerplate to define tasks and stle guides. Please read the readme of the project to learn more about how to contribute.

You can contribute by opening a pull request. Make sure your code complies with the quality standards by running the following task:

grunt test

Nuget

A nuget package is available. To install Hylasoft.Behavior, run the following command in the Package Manager Console:

PM> Install-Package Hylasoft.Behavior