following code throws InvalidOperationException

 public interface ISomething
        {
            int Do<T>(int i,Action<string> s);
        }
        [Test]
        public void IssueTest()
        {
            MockRepository mocks = new MockRepository();
            var smth = mocks.StrictMock<ISomething>();
            smth.Expect(s => s.Do<string>(1,
null)).IgnoreArguments().Callback<int, string>((args0, args1) =>
true).Return(1).Repeat.Twice();
            mocks.ReplayAll();

            smth.Do<string>(1, Console.WriteLine);
            smth.Do<string>(1, Console.WriteLine);
            smth.Do<string>(1, Console.WriteLine);
        }


while the following throws
Rhino.Mocks.Exceptions.ExpectationViolationException :
ISomething.Do<System.String>(1, "abc"); Expected #2, Actual #3.

public interface ISomething
        {
            int Do<T>(int i,string s);
        }
        [Test]
        public void IssueTest()
        {
            MockRepository mocks = new MockRepository();
            var smth = mocks.StrictMock<ISomething>();
            smth.Expect(s => s.Do<string>(1,
null)).IgnoreArguments().Callback<int, string>((args0, args1) =>
true).Return(1).Repeat.Twice();
            mocks.ReplayAll();

            smth.Do<string>(1, "abc");
            smth.Do<string>(1, "abc");
            smth.Do<string>(1, "abc");
        }



Are there any workaround to get ExpectationViolationException  when
stubbing methods with Action in params?




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