No. Mocking Request Principal has its own issues (no default
constructor and etc). I'm trying to see if there's a way to simply
say if someone calls SomeUnMockedObject.GetMeAList() if there is a way
to simply set an expectation for that call to always return
List<Whatever> SomeEmptyList without actually mocking or instantiating
the SomeUnMockedObject.
On Jan 30, 3:35 pm, "Adam Dymitruk" <
adymit...@gmail.com> wrote:
> You need to set the expectation on Current, not GetPrograms.
> RequestPrincipal is what you are mocking, no?
>
> Adam
>
> On Jan 30, 2008 3:11 PM, Luke <
jalm...@gmail.com> wrote:
>
>
>
>
>
> > I've been struggling with this for a couple hours now and for the life
> > of me can't figure out how to make it work.
>
> > Here's the case:
> > The presenter has a call
> > this.view.programs=RequestPrincipal.Current.GetPrograms;
> > The RequestPrincipal class is something that is very cumberson to mock
> > and etc but all it does is return a CustomTypeArray[] so I'm trying to
> > figure out if I can do something like this:
> > Expect.Call(RequestPrincipal.Current.GetPrograms).Return(dummyCustomTypeArray);
>
> > The issue that I get is "System.NullReferenceException: Object
> > reference not set to an instance of an object.." because
> > RequestPrincipal is not created anywhere. Is there another way of
> > doing this? Just setting up an expected call to some method on a
> > not-mocked object and explicitly telling it to return a result.
>
> > Thanks so much,
> > Luke- Hide quoted text -
>
> - Show quoted text -