示例#1
0
        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());
        }
示例#2
0
 public virtual ServiceCalls FindCalls(ServiceCall match)
 {
     return(ServiceCalls.Matching(match));
 }
示例#3
0
 public virtual void Add(ServiceCall serviceCall)
 {
     ServiceCalls.Add(serviceCall);
 }
示例#4
0
 public ExecutionHistory()
 {
     ServiceCalls = new ServiceCalls();
 }