Пример #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);
 }