I'm currently writing a library of helper functions to produce some repetitive markup. I have a reference to the markup the functions should produce, but I'm curious about how I should go about unit testing this?
There are a lot of unit tests needed to get full coverage of the number of different variations of output from each function. Currently, I have a T4 template for each function which builds unit tests for every combination of inputs to that function.
Each unit test does a single assert against a string containing the reference markup. However, writing out these individual bits of markup by hand would take a long time so I wrote another small helper function which basically replicates the same logic I'm testing, but in a less flexible manner, to produce the expected string.
It occurs to me that this may not be the best idea? Or is this an OK approach to this kind of problem? What are the best practices surrounding this?
Example unit test
[TestMethod]
public void Function_P1_P2_P3()
{
string markup = HelperLib.MakeMarkup(P1, P2, P3);
Assert.AreEqual(this.MakeExpectedString(P1, P2, P3), markup);
}