private ICall[] AllCallsExceptPropertyGettersReceivedByTargetsOf(CallSpecAndTarget[] querySpec) { var allUniqueTargets = querySpec.Select(s => s.Target).Distinct(); var allReceivedCalls = allUniqueTargets.SelectMany(target => target.ReceivedCalls()); return(allReceivedCalls.Where(x => _queryFilter.ShouldVerify(x.GetMethodInfo())).ToArray()); }
public void Assert(IQueryResults queryResult) { var array1 = queryResult.MatchingCallsInOrder().Where(x => _queryFilter.ShouldVerify(x.GetMethodInfo())).ToArray(); var array2 = queryResult.QuerySpecification().Where(x => _queryFilter.ShouldVerify(x.CallSpecification.GetMethodInfo())).ToArray(); if (array1.Length != array2.Length) { throw new CallSequenceNotFoundException(GetExceptionMessage(array2, array1)); } if (array1.Zip(array2, (call, specAndTarget) => new { Call = call, Spec = specAndTarget.CallSpecification, IsMatch = Matches(call, specAndTarget) }).Any(x => !x.IsMatch)) { throw new CallSequenceNotFoundException(GetExceptionMessage(array2, array1)); } }