DynamicMock.ExpectNoCall() problem
"Adam Connelly" <[email protected]>
| Newsgroups | gmane.comp.windows.dotnet.nunit.user |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I have a problem with DynamicMock.ExpectNoCall() because it appears to cause
an exception to be thrown as soon as the method is called, rather than
waiting for Verify(). This causes one of my tests to pass, even though the
method was called because the exception gets caught. Here's an example of
what I mean:
ConnectionInfo connectionInfo = View.GetConnectionInfo();
try
{
Client.OpenConnection(connectionInfo, this);
}
catch (PushConnException e)
{
View.ShowErrorMessage(new Exception("Could not connect to server", e));
}
catch (Exception e)
{
View.ShowErrorMessage(e);
}
I realise that I probably shouldn't have a catch (Exception) call - I've
temporarily put it there because the library I'm using won't let me
construct the other Exceptions that can be thrown by OpenConnection().
Ideally, the AssertionException wouldn't be thrown until I call Verify() in
the test - but then again I've not looked into how DynamicMock is
implemented, so maybe there's a reason it works like it does.
Is there any solution to this, or do I just have to rethrow the exception
(which I'd ideally not do for the exceptions that I'm "expecting").
Cheers,
Adam
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Nunit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nunit-users