Probably the best advice I've heard all day.  Thanks again.

On Nov 14, 10:02 am, "Ayende Rahien" <[EMAIL PROTECTED]> wrote:
> Create a dummy implementation for this yourself, it will make your life much
> easier
>
>
>
> On Fri, Nov 14, 2008 at 5:44 PM, Adam <[EMAIL PROTECTED]> wrote:
>
> > Thank you immensley!
>
> > I'm sorry to ask yet another question, but is this behavior possible
> > with a Stub, so that when you assign a value to the property, the
> > value actually "sticks"?  Obviously a Stub throws an exception when
> > you set up an expectation like this.
>
> > What I was trying to do, which I was already realizing was a bad idea,
> > was using Rhino not only for unit testing, but also, just until I can
> > get data into my DB, running my app on them.  The app expects an
> > interface, and so doesn't really care if it's a Mock object, or a LINQ
> > object.  Is this just fundamentally a bad idea?
>
> > AJR
>
> > On Nov 14, 8:58 am, "Ayende Rahien" <[EMAIL PROTECTED]> wrote:
> > > Here is how you can do it, but at this point, I think that you are not
> > using
> > > Rhino Mocks correctly.
> > > Rhino Mocks is to test interactions of objects, trying to use it to
> > create
> > > complex interaction is possible, but likely to cause complexities down
> > the
> > > road.
>
> > > [TestFixture]
> > > public class FieldProblem_Adam
> > > {
> > >     public interface IFoo
> > >     {
> > >         string Str { get; set; }
> > >         event EventHandler Event;
> > >     }
>
> > >     [Test]
> > >     public void ShouldRaiseEventWhenEverPropIsSet()
> > >     {
> > >         var foo = MockRepository.GenerateMock<IFoo>();
> > >         foo.Stub(x => x.Str = Arg<string>.Is.Anything)
> > >             .WhenCalled(x => foo.Raise(y => y.Event += null, foo,
> > > EventArgs.Empty));
>
> > >         int calls = 0;
> > >         foo.Event += delegate
> > >         {
> > >             calls += 1;
> > >         };
>
> > >         foo.Str = "1";
> > >         foo.Str = "2";
> > >         foo.Str = "3";
> > >         foo.Str = "4";
>
> > >         Assert.AreEqual(4, calls);
> > >     }
>
> > > }
> > > On Fri, Nov 14, 2008 at 1:27 AM, Adam <[EMAIL PROTECTED]> wrote:
>
> > > > Well here's a new, clean post.  With the following code, how would I
> > > > go about firing off EventFoo each and every time str is assigned to -
> > > > regardless of the value assigned.
>
> > > > Thanks!
>
> > > > namespace ConsoleApplication3 {
> > > >    class Program {
> > > >        static void Main(string[] args) {
> > > >            IFoo F = MockRepository.GenerateStub<IFoo>();
>
> > > >        }
> > > >    }
>
> > > >    public interface IFoo {
> > > >        string str { get; set; }
> > > >        event EventHandler EventFoo;
> > > >    }
>
> > > > }- 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to