private void CheckTooManyInvocations() { if (ExpectedInvocationCount < Invocations.Count) { throw SequenceVerifyException.TooManyCallsException(ExpectedInvocationCount, Invocations.Count); } }
private void VerifyInvocation(int loop, int expectedInvocationIndex) { CheckTooManyInvocations(); if (GetInvocation(loop, expectedInvocationIndex) != expectedInvocations[expectedInvocationIndex]) { throw SequenceVerifyException.OutOfSequenceException(loop + 1, expectedInvocationIndex); } }
private IInvocable GetInvocation(int loop, int expectedInvocation) { var expectedNumberOfInvocations = expectedInvocations.Count; var invocationNumber = loop * expectedNumberOfInvocations + expectedInvocation; try { return(Invocations[invocationNumber]); } catch (ArgumentException) { throw SequenceVerifyException.InsufficientCallsException(loop + 1, expectedInvocation); } }
public void Verify() { if (VerifiesUponInvocation()) { if (!ReceivedExpectedNumberOfInvocations) { CheckTooManyInvocations(); throw SequenceVerifyException.InsufficientCallsException(verifyCurrentInvocationLoop + 1, verifyCurrentInvocationExpectedInvocationIndex); } } else { VerifyAllInvocationIndices(); } }