Skip to content

Instantly share code, notes, and snippets.

@follesoe
Created May 19, 2010 06:07
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save follesoe/406014 to your computer and use it in GitHub Desktop.
Save follesoe/406014 to your computer and use it in GitHub Desktop.
// Tiniest BDD DSL/framework around?
// Licensed under MSPL/FreeBSD/ISC or any other OSS license you want
// Original idea from http://blog.kjempekjekt.com/2009/08/13/ultra-tiny-given-when-then-dsl-snippet/,
// turned into generic base class by Jonas Follesø.
public abstract class BDD<T> where T : BDD<T>
{
protected T Given { get { return (T)this; } }
protected T And { get { return (T)this; } }
protected T When { get { return (T)this; } }
protected T Then { get { return (T)this; } }
}
[Fact]
public void The_mismatch_exception_message_contains_information_about_the_mismatch()
{
Given.we_have_mismatch_exception_for_a_specific_comparison();
When.we_read_the_message_of_the_exception();
Then.it_tells_us_what_the_difference_is();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment