GithubHelp home page GithubHelp logo

fjsnogueira / given Goto Github PK

View Code? Open in Web Editor NEW

This project forked from copypastedeveloper/given

0.0 3.0 0.0 1.84 MB

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

C# 100.00%

given's Introduction

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));
    }
}

given's People

Contributors

copypastedeveloper avatar karsonalford avatar lscharen avatar

Watchers

James Cloos avatar Fernando Nogueira avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.