我试图说明一个方法在存根上被调用。我试图断言的方法被称为IEnumerable<string>
。我不在乎确切的内容,但我只想测试计数是一定的数字。我不能断言是正确的,我得到犀牛模拟列表约束
Rhino.Mocks.Exceptions.ExpectationViolationException : Bob.DoThings(collection count equal to 10); Expected #1, Actual #0.
我知道DoThings()的确是被称为...我只是不能得到正确的约束..
var myBob= MockRepository.GenerateStub<Bob>();
var countConstraint = Rhino.Mocks.Constraints.List.Count(Rhino.Mocks.Constraints.Is.Equal(10));
// execution code....
Joe myJoe = new Joe(myBob);
myJoe.MethodThatShouldCallDoThingWith10();
myBob.AssertWasCalled(s => s.DoThings(null), o => Constraints(countConstraint));
我我们也尝试添加“IgnoreArguments”作为约束条件。我错过了什么?
Patrick,I没有意识到GetArgumentsForCallsMadeOn()方法。我能够在这里写出一个有意义的断言。迟到的执行问题似乎在最近经常出现。谢谢。 –