Skip to content

Instantly share code, notes, and snippets.

@Zerophase
Created May 25, 2014 21:25
Show Gist options
  • Save Zerophase/352e4e065a16b0f83bcf to your computer and use it in GitHub Desktop.
Save Zerophase/352e4e065a16b0f83bcf to your computer and use it in GitHub Desktop.
public abstract class GenericParserTests<T>
where T : IStringParser
{
protected abstract string GetInputHeaderSingleDigit();
// creates and returns intance of class inheriting from IStringParser
protected T GetParser(string input)
{
return (T)Activator.CreateInstance(typeof(T), input);
}
[Test]
public void GetStringVersionFromHeader_SingleDigit_Found()
{
string input = GetInputHeaderSingleDigit();
T parser = GetParser(input);
bool result = parser.HasCorrectHeader();
Assert.IsFalse(result);
}
// additional tests
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment