Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Given is a bdd library made with the intent of wrapping common testing frameworks easily.
branch: master

Merge pull request #15 from lscharen/patch-1

Fix the h5 closing tag in the report template
latest commit c0abbd43a3
Nathan Gonzalez authored

README.md

given

Given is a bdd library made with the intent of wrapping common testing frameworks easily.

NUnit Example:

[Story(AsA = "car manufacturer",
       IWant = "a factory that makes the right cars",
       SoThat = "I can make money")]
public class when_building_a_toyota : Scenario
{
    static CarFactory _factory;
    static Car _car;

    given a_car_factory = () =>
                              {
                                  _factory = new CarFactory();
                              };

    when building_a_toyota = () => _car = _factory.Make(CarType.Toyota);

    [then]
    public void it_should_create_a_car()
    {
        _car.ShouldNotBeNull();
    }

    [then]
    public void it_should_be_the_right_type_of_car()
    {
        _car.Type.ShouldEqual(CarType.Toyota);
    }
}

MSTest Example:

[TestClass]
[Story(AsA = "car manufacturer",
       IWant = "a factory that makes the right cars",
       SoThat = "I can make money")]
public class when_building_a_toyota : Scenario
{
    static CarFactory _factory;
    static Car _car;

    given a_car_factory = () =>
                              {
                                  _factory = new CarFactory();
                              };

    when building_a_toyota = () => _car = _factory.Make(CarType.Toyota);

    [TestMethod]
    public void it_should_create_a_car()
    {
        //the then method allows us to log exceptions.
        //if that isn't important to you, you can leave it out.
        then(() =>_car.ShouldNotBeNull());
    }

    [TestMethod]
    public void it_should_be_the_right_type_of_car()
    {
        then(() => _car.Type.ShouldEqual(CarType.Toyota));
    }

    [TestMethod]
    public void it_should_be_the_wrong_type_of_car()
    {
        then(() => _car.Type.ShouldEqual(CarType.Ford));
    }
}
Something went wrong with that request. Please try again.