I have a unit test and I check for null exceptions of my controller constructor for several different services.
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
In my controller constructor, I:
if (routeCategoryServices == null)
throw new ArgumentNullException("routeCategoryServices");
if (routeProfileDataService == null)
throw new ArgumentNullException("routeProfileDataService");
I have a unit test for each, but how can I distinguish between the two. I can leave the test as is, since any of the checks can cause zero, so I want to check the exception by the parameter name.
Is it possible?
Simon source
share