Skip to content

Instantly share code, notes, and snippets.

@jalchr
Created December 28, 2011 17:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jalchr/1528815 to your computer and use it in GitHub Desktop.
Save jalchr/1528815 to your computer and use it in GitHub Desktop.
SpecFor Sample
[Given(typeof(the_entity_is_available))]
public class When_entity_is_on_hold : SpecsFor<Entity>
{
public When_entity_is_on_hold(Type[] contexts) : base(contexts) { }
protected override void InitializeClassUnderTest()
{
SUT = new Shared().CreateEntity();
}
protected override void When()
{
Console.WriteLine("When condition met ");
base.When();
}
[Test]
public void then_can_not_pay()
{
Console.WriteLine("Okay, Can not pay");
}
}
public class the_entity_is_available : IContext<Entity>
{
public void Initialize(ITestState<Entity> state)
{
state.GetMockFor<Entity>();
Console.WriteLine("Transaction created !");
}
}
public class Entity
{
private string _name;
private Entity()
{
_name = "";
}
public Entity(string name)
{
_name = name;
}
public string Name { get { return _name; } }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment