예제 #1
0
        /// <summary>
        /// Get the expectation for this method on this object with this arguments
        /// </summary>
        public IExpectation GetRecordedExpectation(IInvocation invocation, object proxy, MethodInfo method, object[] args)
        {
            Validate.IsNotNull(proxy, "proxy");
            Validate.IsNotNull(method, "method");
            Validate.IsNotNull(args, "args");
            if (replayerToCall != null)
            {
                return(replayerToCall.GetRecordedExpectation(invocation, proxy, method, args));
            }

            //merge recorders that contains only a single empty recorder
            if (recordedActions.Count == 1 && recordedActions[0] is IMethodRecorder)
            {
                replayerToCall = (IMethodRecorder)recordedActions[0];
                return(replayerToCall.GetRecordedExpectation(invocation, proxy, method, args));
            }

            IExpectation expectation = DoGetRecordedExpectation(invocation, proxy, method, args);

            if (HasExpectations == false)
            {
                MoveToParentReplayer();
            }
            return(expectation);
        }
예제 #2
0
        /// <summary>
        /// Get the expectation for this method on this object with this arguments 
        /// </summary>
        public IExpectation GetRecordedExpectation(IInvocation invocation, object proxy, MethodInfo method, object[] args)
        {
            Validate.IsNotNull(proxy, "proxy");
            Validate.IsNotNull(method, "method");
            Validate.IsNotNull(args, "args");
            if (replayerToCall != null)
                return replayerToCall.GetRecordedExpectation(invocation, proxy, method, args);

            //merge recorders that contains only a single empty recorder
            if (recordedActions.Count == 1 && recordedActions[0] is IMethodRecorder)
            {
                replayerToCall = (IMethodRecorder)recordedActions[0];
                return replayerToCall.GetRecordedExpectation(invocation, proxy, method, args);
            }

            IExpectation expectation = DoGetRecordedExpectation(invocation, proxy, method, args);
            if (HasExpectations == false)
                MoveToParentReplayer();
            return expectation;
        }
예제 #3
0
 public void HasExpectationsAfterGettingRecordedExpectation()
 {
     recorder.Record(this.demo, this.voidNoArgs, expectationOne);
     recorder.GetRecordedExpectation(new FakeInvocation(voidNoArgs), demo, voidNoArgs, new object[0]);
     Assert.False(recorder.HasExpectations);
 }