Skip to content

Instantly share code, notes, and snippets.

@speier
Created April 11, 2011 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save speier/914452 to your computer and use it in GitHub Desktop.
Save speier/914452 to your computer and use it in GitHub Desktop.
[Binding]
class CalculatorSteps
{
private readonly StandardKernel _kernel = new StandardKernel();
private ICalculator _calc;
private int _lastResult;
public CalculatorSteps()
{
_kernel.Bind<ICalculator>().To<Calculator>();
}
[Given(@"a calculator")]
public void GivenACalculator()
{
_calc = _kernel.Get<ICalculator>();
}
[When(@"I sum (\d+) and (\d+)")]
public void WhenISum(int num1, int num2)
{
_lastResult = _calc.Sum(num1, num2);
}
[Then(@"the result should be (\d+)")]
public void ThenTheResultShouldBe(int result)
{
Assert.AreEqual(result, _lastResult);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment