コード例 #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);
 }