Skip to content

Instantly share code, notes, and snippets.

@hanson-andrew
Created November 1, 2013 15:03
Show Gist options
  • Save hanson-andrew/7266770 to your computer and use it in GitHub Desktop.
Save hanson-andrew/7266770 to your computer and use it in GitHub Desktop.
My attempt at Roy Osherove's TDD Kata 1 ended up with this skeleton
public class Math
{
private _parser As IParser;
public Math(IParser parser)
{
this._parser = parser;
}
public int Add(string numbers)
{
IEnumerable<int> numbers = this._parser.ParseNumbers(numbers)
//Add them up and return the value
}
}
public class Parser : IParser
{
public IEnumerable<int> ParseNumbers(string numbers)
{
//Let's assume I do this correctly here
}
}
public interface IParser
{
IEnumerable<int> ParseNumbers(string numbers);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment