in fact I have a mock object based on the interface. I would like to cast him into the real object..
var BM = new Mock<DAL.INTERFACES.IMYCLASS>();
Is it possible to cast the mock to retrieve a MYCLASS object?
Thanks for responses..
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Using moq allows you to test your class, which relies on other classes/interfaces, without needing to instantiate them.
If you want an instance of an object which implements your interface, you can simply call
Objecton your member:Don’t forget to setup the required methods your testclass relies on. Further information can be found on the QuickStart guide on the moq homepage.