does MockRepository.GenerateMock<IIndexed>() have the same result?
2009/11/12 kbaltrinic <[email protected]>
>
> I am have trouble asserting that an indexer was called using AAA and
> AssertWasCalled. Here is an example test that is failing. This is
> with Rhino Mocks 3.6.0.0 and NUnit 2.5.2.9222. Am I missing something
> obvious?
>
> public interface IIndexed { object this[string key] { get;
> set; } }
>
> [Test]
> public void testCallToIndexer()
> {
> var indexed = MockRepository.GenerateStub<IIndexed>();
> indexed["Key"] = "Value";
> indexed.AssertWasCalled(i => i["Key"] = "Value");
>
> //indexed.AssertWasCalled(i => i["Key"] = "Value",
> // options => options.IgnoreArguments()); <--Also
> tried this with basically the same result.
> }
>
> Results:
>
> Rhino.Mocks.Exceptions.ExpectationViolationException :
> IIndexed.set_Item("Key", "Value"); Expected #1, Actual #0.
> at Rhino.Mocks.RhinoMocksExtensions.AssertWasCalled(T mock, Action`1
> action, Action`1 setupConstraints)
> at Rhino.Mocks.RhinoMocksExtensions.AssertWasCalled(T mock, Func`2
> action)
> at Tests.ExampleTests.testCallToIndexer() in ExampleTests.cs: line 89
>
> Thanks for the help,
> --Ken
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---