Off the top of my head, I would say something like ...
WhenFooIsOpenedExclusivelyAndOpenIsCalledOnContainer_ShouldThrowMyNewException
and with regards to your *need* to test that Close() was not called :
this is not really required, since the Open() method throws an
exception and Close() is only invoked when an exception is not thrown
(in your original code), however this is not th case if you should
change your try/catch block to include a finally clause, i.e.
try
{
container.Open();
}
catch(MyNewExceptionType)
{
exceptionWasThrown = true;
}
finally
{
uut.Close();
}
under these circumstances, you will need to assert that Close() was
not called.
try
{
container.Open();
}
catch(MyNewExceptionType)
{
exceptionWasThrown = true;
}
uut.Close();
under these circumstances, you will not need to assert that Close()
was not called.
On Feb 10, 11:42 pm, Kevinst <[email protected]> wrote:
> Thank you guys. I think I will just live with it.
>
> I would have used that ExpectedException attribute but I have to call
> mock.VerifyAllExpectations() after the exception was thrown to make
> sure no Close was executed.. so I have to catch it I guess?
> The Exception is a custom one.. I just didnt want to overload my
> thread ;-)
>
> What would your new name suggestion be?
--
You received this message because you are subscribed to the Google Groups
"Rhino.Mocks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rhinomocks?hl=en.