Is there a way I can achieve this result using Rhino Mocks?
On Nov 13, 4:50 pm, "Ayende Rahien" <[EMAIL PROTECTED]> wrote:
> That is why you don't see it in intelisense
>
>
>
> On Fri, Nov 14, 2008 at 12:48 AM, Adam <[EMAIL PROTECTED]> wrote:
>
> > The event is explicitly declared in my interface. I'm trying to get a
> > stub of it, and raise the event anytime the property in question is
> > set. Here's how I'm getting the stub
>
> > Models.ISevTrackWellRecord result =
> > MockRepository.GenerateStub<Models.ISevTrackWellRecord>();
>
> > On Nov 13, 4:46 pm, "Ayende Rahien" <[EMAIL PROTECTED]> wrote:
> > > a) are you explicitly implementing this?
>
> > > On Fri, Nov 14, 2008 at 12:45 AM, Adam <[EMAIL PROTECTED]> wrote:
>
> > > > Well that gets me here:
>
> > > > result.Stub(x => x.TCOApprovalDate = DateTime.Now).IgnoreArguments
> > > > ().Raise(x => x.PropertyChanged
>
> > > > but again, PropertyChanged is not visible from within the lambda
> > > > expression.
>
> > > > On Nov 13, 4:40 pm, "Ayende Rahien" <[EMAIL PROTECTED]> wrote:
> > > > > IgnoreArguments()
>
> > > > > On Fri, Nov 14, 2008 at 12:38 AM, Adam <[EMAIL PROTECTED]>
> > wrote:
>
> > > > > > I'm using 3.5. Would the code below stub only when the property
> > was
> > > > > > assigned whatever's in someval? Is there a way to set up behavior
> > for
> > > > > > setting *any* value?
>
> > > > > > Thanks!
>
> > > > > > On Nov 13, 4:35 pm, "Ayende Rahien" <[EMAIL PROTECTED]> wrote:
> > > > > > > What version are you using?
> > > > > > > foo.Stub(x=>x.Bar = someVal)
>
> > > > > > > On Fri, Nov 14, 2008 at 12:34 AM, Adam <[EMAIL PROTECTED]>
> > > > wrote:
>
> > > > > > > > How do I set up behavior for setting a property? Also, I can't
> > > > seem
> > > > > > > > to find a WhenCalled method. Thanks again.
>
> > > > > > > > On Nov 13, 4:25 pm, "Ayende Rahien" <[EMAIL PROTECTED]> wrote:
> > > > > > > > > You need to put this in the WhenCalled() method.Also, note
> > that
> > > > in
> > > > > > your
> > > > > > > > > Stub, you are creating an expectation for GETTING the
> > property
> > > > value,
> > > > > > not
> > > > > > > > > setting it.
>
> > > > > > > > > On Fri, Nov 14, 2008 at 12:21 AM, Adam <
> > [EMAIL PROTECTED]>
> > > > > > wrote:
>
> > > > > > > > > > I'm trying to automatically raise the event every time a
> > > > property
> > > > > > is
> > > > > > > > > > assigned to. The example seemed to imply that I needed
> > this:
>
> > > > > > > > > > result.Stub(x => x.TCOApprovalDate).Raise(x =>
> > > > x.PropertyChanged +=
> > > > > > > > > > null, new System.ComponentModel.PropertyChangingEventArgs
> > > > > > > > > > ("TCOApprovalDate"));
>
> > > > > > > > > > but x.PropertyChanged is not being found by the compiler.
> > Any
> > > > help
> > > > > > > > > > you can provide would be much appreciated. Thanks.
>
> > > > > > > > > > On Nov 13, 3:59 pm, "Ayende Rahien" <[EMAIL PROTECTED]>
> > wrote:
>
> > > >http://codebetter.com/blogs/jean-paul_boodhoo/archive/2007/05/07/rais.
> > > > > > ..
>
> > > > > > > > > > > On Thu, Nov 13, 2008 at 11:55 PM, Adam <
> > > > [EMAIL PROTECTED]>
> > > > > > > > wrote:
>
> > > > > > > > > > > > I'm mocking an object which implements
> > > > INotifyPropertyChanged.
> > > > > > How
> > > > > > > > > > > > would I go about having my mock raise this event.
> > Here's
> > > > what
> > > > > > I
> > > > > > > > have:
>
> > > > > > > > > > > > result.Stub(x => x.TCOApprovalDate).Raise(x =>
> > > > > > > > result.PropertyChanged,
> > > > > > > > > > > > new System.ComponentModel.PropertyChangingEventArgs
> > > > > > > > > > > > ("TCOApprovalDate"));
>
> > > > > > > > > > > > Obviously the compiler does not like
> > result.PropertyChanged
> > > > > > since
> > > > > > > > > > > > result is out of scope for the lambda expression. How
> > do I
> > > > > > tell
> > > > > > > > the
> > > > > > > > > > > > mock to raise the PropertyChanged event when a certain
> > > > property
> > > > > > > > > > > > changes on the mock?
>
> > > > > > > > > > > > Thanks!- Hide quoted text -
>
> > > > > > > > > > > - Show quoted text -- Hide quoted text -
>
> > > > > > > > > - Show quoted text -- Hide quoted text -
>
> > > > > > > - Show quoted text -- Hide quoted text -
>
> > > > > - Show quoted text -- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---