I have a class like so:
public abstract class ClassA<T>
{
protected ClassA(IInterface interface)
{
if (interface== null)
{
throw new ArgumentNullException ("interface");
}
}
}
I want to write a test which verifies that if I pass null in the exception is thrown:
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public TestMethod()
{
ClassA classa = MockRepository.GenerateMock<ClassA<String>> (null);
}
but the test keeps failing with an exception rather than the exception being expected. I also tried wrapping the call in a try catch block, but same issue. I tried GenerateStub and PartialMock.
What am I missing?