you have to stub the property instead of stubbing the method, and
probably create another test to test the method.
you need to set InternalsVisibleTo("yourtest.dll") so that you'll be
able to test the internal method.

see 
http://ebsteblog.wordpress.com/2008/02/12/accessing-internal-methods-in-unit-tests/

On May 12, 9:37 am, Varun Bhargava <[email protected]> wrote:
> Hi There,
>
> I have a property that i want to stub
>
>                 public List<Record> Records
>                 {
>                         get
>                         {
>                                 PopulateRecords();
>                                 return records;
>                         }
>                 }
>
> internal virtual void PopulateRecords()
>                 {
>                         records = new List<Record>();
>                         .....
>                 }
>
> If in my stub i say mockResult.Stub(r => r.Records).Return(new
> List<Record>());
> I get an error like 'doesn't match the return type 'System.Void' for
> method 'Result.PopulateEndecaRecords();''
>
> How do i solve this?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Rhino.Mocks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group 
> athttp://groups.google.com/group/rhinomocks?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Rhino.Mocks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rhinomocks?hl=en.

Reply via email to