Say I have a method
public void PrintStuff(string stuff, Color color, PageDimensions dimensions)
{
Assert.IsNotNull("color");
Assert.IsNotNull(dimensions);
Assert.IsTrue(dimensions.width < 20.0);
}
and I have another method AnotherMethod()
which is calling PrintStuff()
. Let's assume PrintStuff()
is defined in some interfaces that AnotherMethod()
is using. The question is: when writing a unit test for AnotherMethod()
how can I automate testing that AnotherMethod()
does not pass any values into PrintStuff()
that violate its assertions?
Something like:
printer.Expect(x => x.PrintStuff(null, null, null)).CheckAssertions();
The solution should support a change in assertions automatically.