Groups
Groups
Sign in
Groups
Groups
Moq Discussions
Conversations
About
Send feedback
Help
Moq class - Constructor with parameter
3,794 views
Skip to first unread message
Swami
unread,
Sep 29, 2011, 3:27:29 PM
9/29/11
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 Moq Discussions
is it possible to mock class with parameter in constructor?
public class testClass
{
public testClass(string s);
}
how do we mock this class?
private Mock<testClass> _testClass = new
Mock<testClass>(MockBehavior.Strict, new object[] {"Hello"});
Is tht ok?
Because when i tried this, i got the following msg:
testClass cannot be serialized because it does not have a
parameterless constructor.
Any idea?
Daniel Cazzulino
unread,
Sep 29, 2011, 4:24:16 PM
9/29/11
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 moq...@googlegroups.com
private Mock<testClass> _testClass = new
Mock<testClass>(MockBehavior.Strict, "Hello");
?
/kzu
--
Daniel Cazzulino | Developer Lead | XML MVP | Clarius Consulting |
+1 425.329.3471
--
Post:
moq...@googlegroups.com
Unsubscribe:
moqdisc-u...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages