Skip to content

Instantly share code, notes, and snippets.

@clausjoergensen
Created December 16, 2011 08:29
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 clausjoergensen/1485119 to your computer and use it in GitHub Desktop.
Save clausjoergensen/1485119 to your computer and use it in GitHub Desktop.
var assembly = typeof(MeterCommunicator).Assembly;
var commands = assembly.GetTypes().Where(t => t.IsSubclassOf(typeof(CommandBase)));
var output = new StringBuilder();
foreach (var command in commands)
{
string test =
@"[TestMethod]
public void {0}Test()
{
{0} target = new {0}();
byte[] expected = {{ CommandBase.CommunicationAddress, {0}.CommandId }};
byte[] actual = target.Create();
CollectionAssert.AreEqual(expected, actual);
}
";
output.AppendFormat(test, command.Name);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment