From: Choy R. <ch...@us...> - 2005-02-19 09:19:51
|
Update of /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29530/DotNetMock/Dynamic Modified Files: ExpectationMethod.cs Log Message: Clarify by renaming variables named expected argument to argument expectations, meaning that we specify abstract expectations on each argument and not the argument itself. Index: ExpectationMethod.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic/ExpectationMethod.cs,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** ExpectationMethod.cs 19 Feb 2005 09:06:26 -0000 1.18 --- ExpectationMethod.cs 19 Feb 2005 09:19:42 -0000 1.19 *************** *** 21,27 **** private string _expectedMethodName; /// <summary> ! /// Any expected arguments for the expected method call /// </summary> ! private object[] _expectedMethodArguments; /// <summary> /// Expected return value for this method call if any. --- 21,27 ---- private string _expectedMethodName; /// <summary> ! /// Expectations on the arguments of the expected method call. /// </summary> ! private object[] _argumentExpectations; /// <summary> /// Expected return value for this method call if any. *************** *** 52,57 **** /// <param name="methodName">Method name to expect</param> /// <param name="returnValue">return value when expectation is called</param> ! /// <param name="expectedArguments">Arguments to expect when called.</param> ! public ExpectationMethod( string methodName, object returnValue, object[] expectedArguments ) : this( methodName, returnValue, expectedArguments, null ){} /// <summary> /// Default Constructor --- 52,57 ---- /// <param name="methodName">Method name to expect</param> /// <param name="returnValue">return value when expectation is called</param> ! /// <param name="argumentExpectations">Expectations on the arguments</param> ! public ExpectationMethod( string methodName, object returnValue, object[] argumentExpectations ) : this( methodName, returnValue, argumentExpectations, null ){} /// <summary> /// Default Constructor *************** *** 59,74 **** /// <param name="methodName">Method name to expect</param> /// <param name="returnValue">return value when expectation is called</param> ! /// <param name="expectedArguments">Arguments to expect when called.</param> /// <param name="expectedException">Exception to throw when called.</param> ! public ExpectationMethod( string methodName, object returnValue, object[] expectedArguments, Exception expectedException) { _expectedMethodName = methodName; ! if (expectedArguments == null) { ! _expectedMethodArguments = new object[0]; } else { ! _expectedMethodArguments = expectedArguments; } --- 59,74 ---- /// <param name="methodName">Method name to expect</param> /// <param name="returnValue">return value when expectation is called</param> ! /// <param name="argumentExpectations">Expectations on the arguments</param> /// <param name="expectedException">Exception to throw when called.</param> ! public ExpectationMethod( string methodName, object returnValue, object[] argumentExpectations, Exception expectedException) { _expectedMethodName = methodName; ! if (argumentExpectations == null) { ! _argumentExpectations = new object[0]; } else { ! _argumentExpectations = argumentExpectations; } *************** *** 192,196 **** "{0}({1}) expected but never called.", ExpectedMethodName, ! argsToString(_expectedMethodArguments) )); } --- 192,196 ---- "{0}({1}) expected but never called.", ExpectedMethodName, ! argsToString(_argumentExpectations) )); } *************** *** 199,203 **** Assertion.Fail(String.Format( "{0}({1}) expected, but {2} called.", ! ExpectedMethodName, argsToString(_expectedMethodArguments), ActualMethodCall )); --- 199,203 ---- Assertion.Fail(String.Format( "{0}({1}) expected, but {2} called.", ! ExpectedMethodName, argsToString(_argumentExpectations), ActualMethodCall )); *************** *** 205,214 **** object[] actualArguments = ActualMethodCall.Arguments; // actual arguments must be greater than or equal to expectations ! if ( actualArguments.Length<_expectedMethodArguments.Length) { Assertion.Fail(String.Format( "Expected {0} arguments but received {1} "+ "in method call {2}.", ! _expectedMethodArguments.Length, actualArguments.Length, ActualMethodCall --- 205,214 ---- object[] actualArguments = ActualMethodCall.Arguments; // actual arguments must be greater than or equal to expectations ! if ( actualArguments.Length<_argumentExpectations.Length) { Assertion.Fail(String.Format( "Expected {0} arguments but received {1} "+ "in method call {2}.", ! _argumentExpectations.Length, actualArguments.Length, ActualMethodCall *************** *** 217,223 **** // assert that each passed in arg is validated by the appropriate predicate. ! for (int i = 0; i < _expectedMethodArguments.Length; i++) { ! object argumentExpectation = _expectedMethodArguments[i]; object actualArgument = actualArguments[i]; --- 217,223 ---- // assert that each passed in arg is validated by the appropriate predicate. ! for (int i = 0; i < _argumentExpectations.Length; i++) { ! object argumentExpectation = _argumentExpectations[i]; object actualArgument = actualArguments[i]; |