Actually I found a workaround: replace this line: mockFactory.Expect(f => f.Create(0)).IgnoreArguments().Return (returnValue1);
with this one: mockFactory.Expect(f => f.Create(0)).IgnoreArguments().Return (returnValue1).Repeat.Once(); and the test passes. On Jan 29, 3:35 pm, andras <[email protected]> wrote: > Hi, > > The test below fails with v3.6.0.0, but it works fine with > 3.5.http://www.mail-archive.com/[email protected]/msg02158.html > seems related. > > Thanks, > andras > > using System; > using NUnit.Framework; > using Rhino.Mocks; > > namespace Sample > { > [TestFixture] > public class Bug_in_Rhino_Mocks > { > public interface IFactory > { > object Create(int param); > } > > [Test] > public void when_setting_up_expectations_with_ignore_arguments > () > { > var mockFactory = MockRepository.GenerateMock<IFactory>(); > > var returnValue1 = new object(); > var returnValue2 = new object(); > > mockFactory.Expect(f => f.Create(0)).IgnoreArguments > ().Return(returnValue1); > mockFactory.Expect(f => f.Create(0)).IgnoreArguments > ().Return(returnValue2); > > var actualReturnValue1 = mockFactory.Create(1); > var actualReturnValue2 = mockFactory.Create(2); > > Assert.AreEqual(returnValue1, actualReturnValue1); > > Console.WriteLine("This value should be true, but it is > {0}", ReferenceEquals(returnValue2, actualReturnValue2)); > > Assert.AreEqual(returnValue2, actualReturnValue2); //<-- > this one fails, but it should pass > } > } > > } -- 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.
