This is a migrated thread and some comments may be shown as answers.

Mock non-public properties?

1 Answer 88 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ken
Top achievements
Rank 1
Ken asked on 06 Sep 2012, 06:48 PM
It is possible to mock non-public properties?

It doesn't appear that Mock.NonPublic permits referencing non-public properties. For example, there appears to be no ArrangeGet or ArrangeSet.

1 Answer, 1 is accepted

Sort by
0
Kaloyan
Telerik team
answered on 10 Sep 2012, 10:29 AM
Hi Kenneth,

 Thank you for contacting us.

 Mocking non-public properties in JustMock is doable. To help you achieving this, I`m sending a sample project with a simple test method that shows how to mock a non-public get property.

 However mocking a non-public set property is not practicable in JustMock for now. We have this in mind and we are working on the issue.

 In addition you can check our online help documentation, where mocking many of the non-public properties is explain and shown in examples:
 http://www.telerik.com/help/justmock/advanced-usage-mocking-non-public-members-and-types.html 

 Let me know if this answers your question.

 

Greetings,
Kaloyan
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
General Discussions
Asked by
Ken
Top achievements
Rank 1
Answers by
Kaloyan
Telerik team
Share this question
or