public virtual LastServiceCallStatus Invoking(Service service, MethodInfo methodInfo) { currentServiceCall = new ServiceCall(service, methodInfo); ServiceCalls matchingHistoryCalls = executionHistory.FindCalls(currentServiceCall); ServiceCalls matchingCurrentServiceCalls = currentServiceCalls.Matching(currentServiceCall); if (matchingHistoryCalls.Count > matchingCurrentServiceCalls.Count) { matchingCurrentServiceCalls.Sort((x, y) => x.CallNumber.CompareTo(y.CallNumber)); int currentCallNumberForService = matchingHistoryCalls.Last().CallNumber; ServiceCall matchingCall = matchingHistoryCalls.Find(obj => obj.CallNumber.Equals(currentCallNumberForService)); currentServiceCalls.Add(matchingCall); return(new LastServiceCallStatus(matchingCall.ReturnValue)); } currentServiceCall.CallNumber = matchingCurrentServiceCalls.Count; return(new NullLastServiceCallStatus()); }
public virtual ServiceCalls FindCalls(ServiceCall match) { return(ServiceCalls.Matching(match)); }
public virtual void Add(ServiceCall serviceCall) { ServiceCalls.Add(serviceCall); }
public ExecutionHistory() { ServiceCalls = new ServiceCalls(); }