Skip to content

Instantly share code, notes, and snippets.

@ToJans
Created November 23, 2012 12:28
Show Gist options
  • Save ToJans/4135416 to your computer and use it in GitHub Desktop.
Save ToJans/4135416 to your computer and use it in GitHub Desktop.
If I could get this to work, this would be awesome IMO
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Shouldly;
namespace AutoBDD.Specs
{
[TestClass]
public class Parse_some_specs
{
AutoBDD.Runner SUT = new AutoBDD.Runner();
[TestMethod]
public void AutoBDD_should_be_able_to_invoke_code_from_a_simple_story()
{
var scenario = @"If I deposit an amount to a new account the balance should be the amount deposited.";
var context = new { Account = new BankAccount(), Amount = 2.5m };
var result = SUT.BuildAction(scenario, context);
result.ShouldBe(() => { context.Account.Deposit(context.Amount); Assert.Equals(context.Account.Balance, context.Amount); });
result();
context.Account.Balance.ShouldBe(context.Amount);
}
}
public class BankAccount
{
public decimal Balance = 0;
public BankAccount()
{
Balance = 0;
}
public void Deposit(decimal Amount)
{
Balance += Amount;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment