Created
November 23, 2012 12:28
-
-
Save ToJans/4135416 to your computer and use it in GitHub Desktop.
If I could get this to work, this would be awesome IMO
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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