SpecsFor<object?>

Posted in General by Mel Grubb Thu May 11 2017 14:52:37 GMT+0000 (UTC)·1·Viewed 277 times

I have a test I need to write that is for a static method on a static class. Since I don't need a SUT to be created, I don't really have anything to put between the angle brackets on the base class. I could just not inherit from SpecsFor at all, but then I have one mutant test that doesn't match the others in terms of style. I'd like to keep the pattern of overriding Given and When for consistency with my other tests. Is there an established or generally accepted pattern for this? I can inherit from SpecsFor<object> and it doesn't seem to complain, but can I count on this in the future?
Matt Honeycutt
May 11, 2017

That's exactly what I do for specs on static methods. I'm open to suggestions on better handling that, but I think SpecsFor<object> will continue to be a valid base specification forever.

  
Markdown is allowed