PartialMock replace a method with void return value
37 views
Skip to first unread message
Angelo
unread,
May 16, 2008, 11:05:57 PM5/16/08
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Rhino.Mocks
I can't seem to be able to figure out how to replace a void message in
a partial mock.
For instance, I want to test a class that uses a System.Net.SmtpClient
to send emails. So, I thought I could use a partial mock of SmtpClient
and pass that in. I want to be able to ignore the Send(MailMessage)
method, thereby testing my method completely without worrying about
actually sending emails.
I can't seem to be able to figure out what to do.
Thanks!
Ayende Rahien
unread,
May 17, 2008, 3:11:22 AM5/17/08
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Rhino...@googlegroups.com
Is Send() a virtual method?
Angelo
unread,
May 17, 2008, 12:47:20 PM5/17/08
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Rhino.Mocks
No, it's not. Does it have to be?
> > Thanks!- Hide quoted text -
>
> - Show quoted text -
isaiah perumalla
unread,
May 17, 2008, 2:49:08 PM5/17/08
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Rhino...@googlegroups.com
hey Angelo you can only mock virtual methods.
-- Isaiah Perumalla
Ayende Rahien
unread,
May 18, 2008, 4:37:52 AM5/18/08
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Rhino...@googlegroups.com
Yes, it does. Or the class must inherit from MarshalByRefObject, which it doesn't.