Closed GoogleCodeExporter closed 8 years ago
It looks like Rhino.Mocks is wrapping the original exception inside of a
System.Exception itself. So MbUnit isn't actually seeing the underlying
ArgumentNullException.
I hesitate to change the behavior to search inside inner exceptions because
that has
other undesirable side-effects on the API such as with Assert.Throws<> which
returns
the exception that was actually caught. Would be confusing if it ended up
returning
an inner exception.
Try this:
var ex = Assert.Throws<Exception>(() => mocks.PartialMock<SomeClass>(null));
Assert.IsInstanceOfType<ArgumentNullException>(ex.InnerException);
Original comment by jeff.br...@gmail.com
on 19 Feb 2009 at 4:56
Original comment by jeff.br...@gmail.com
on 19 Feb 2009 at 5:03
Thanks for the reply. I'll give the suggested work around a try, although it is
strange that MbUnit 2.4 worked flawlessly with Rhino.Mocks.
Original comment by m...@andreloker.de
on 20 Feb 2009 at 3:14
Hi,
Same problem here. We have made lots of tests to check that our classes
correctly
throw ArgumentNullException when a null parameter is passed to the constructor.
They
are now all failing since we migrated to MbUnit 3.
Original comment by charles....@gmail.com
on 19 Mar 2009 at 2:48
Maybe you could try to convince Oren to use a method like
ExceptionUtils.RethrowWithNoStackTraceLoss.
Alternately, Yann recently added an overload of Assert.Throws that takes an
inner
exception type like this: Assert.Throws<Exception, ArgumentNullException>(() =>
...);
Original comment by jeff.br...@gmail.com
on 4 Dec 2009 at 4:50
Original issue reported on code.google.com by
m...@andreloker.de
on 14 Feb 2009 at 12:56