You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to verify that a call is not made before another call in a sequence. (It is actually made afterwards, not part of what I want to test but is causing the issue).
Here is a repro:
[Test]publicvoidSequenceTest(){varbar=newMock<IBar>();varbaz=newMock<IBaz>();varsut=newFoo(bar.Object,baz.Object);using(Sequence.Create()){baz.Setup(x =>x.DoBazThings()).InSequence(Times.Never());bar.Setup(x =>x.DoBarThings()).InSequence(Times.Once());// baz.Setup(x => x.DoBazThings()).InSequence(Times.Once()); // uncomment this to make this test passsut.DoTheThing();}}publicinterfaceIBar{voidDoBarThings();}publicinterfaceIBaz{voidDoBazThings();}privateclassFoo{privatereadonlyIBar_bar;privatereadonlyIBaz_baz;publicFoo(IBarbar,IBazbaz){_bar=bar;_baz=baz;}publicvoidDoTheThing(){_bar.DoBarThings();_baz.DoBazThings();}}
This currently fails with:
Moq.Sequences.SequenceException : Exceeded maximum number of invocations.
Expected invocation on the mock should never have been performed, but was 1 times: 'x => x.DoBazThings()'
I would expect that once a condition for a sequence has been completed that it would stop checking it, like when DoBarThings is called, the requirement that DoBazThings is never called would be "cleared".
The text was updated successfully, but these errors were encountered:
I'm trying to verify that a call is not made before another call in a sequence. (It is actually made afterwards, not part of what I want to test but is causing the issue).
Here is a repro:
This currently fails with:
I would expect that once a condition for a sequence has been completed that it would stop checking it, like when
DoBarThings
is called, the requirement thatDoBazThings
is never called would be "cleared".The text was updated successfully, but these errors were encountered: