Yep -- you got it exactly.

Steve Bohlen
[email protected]
http://blog.unhandled-exceptions.com
http://twitter.com/sbohlen


On Wed, Nov 16, 2011 at 4:16 PM, rhyous <[email protected]> wrote:

> Ok, let me see if I understood correctly.
>
> I understand from what you said that I should not use the expect()
> function or the VerifyAllExpectations() because it is legacy and for
> backwards compatibility only with a play/replace feature that is
> deprecated. Assert.WasCalled() is the new preferred way.
>
> Did I understand correctly?
>
> On Nov 16, 1:36 pm, bill richards <[email protected]>
> wrote:
> > This is one of your tests ...
> >
> >         public void FoundDotNet20_Test_KeyExists()
> >         {
> >             bool isInstalled = true;
> >             DotNetFramework target = new DotNetFramework();
> >             IRegistryKey key =
> >
> CreateDotNetRegistryOpenSubKeyMock(DotNetFramework.REGPATH_DOTNET20_VERSION
> ,
> > isInstalled);
> >             target.ChangeBaseKey(key);
> >             bool expected = true;
> >             bool actual = target.FoundDotNet20;
> >             Assert.AreEqual(actual, expected);
> >
> >             // Works
> >             key.AssertWasCalled(x =>
> > x.OpenSubKey(DotNetFramework.REGPATH_DOTNET20_VERSION));
> >             // Fails
> >             key.VerifyAllExpectations();
> >         }
> >
> > the line marked // Fails ... should fail, because you have not
> > "recorded" and "replayed". VerifyAllExpectations() forms part of the
> > Record/Replay syntax AssertWasCalled() *is* the assertion you should
> > be using in these tests.
> >
> >  ... and I know it's a breaking change, but IMHO I think that we
> > should do something to remove the Record/Replay syntax backward
> > compatibility -it just makes the library a little confusing
> >
> > On Nov 15, 12:28 am, rhyous <[email protected]> wrote:
> >
> >
> >
> >
> >
> >
> >
> > > I am learning Rhino Mocks and I have created a very small sample
> > > project that you can all access.
> http://www.rhyous.com/wp-content/uploads/2011/11/DotNetFrameworkTest.zip
> >
> > > I am wondering what I am doing wrong here.
> > > VerifyAllExpectations() fails when AssertWasCalled() succeeds and this
> > > has me pretty confused.
> >
> > > I have spent a couple hours troubleshooting and thought I would throw
> > > this to the mailing list.
> >
> > > Thanks,
> >
> > > Jaredhttp://www.rhyous.com
>
> --
> 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.
>
>

-- 
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