Exemple #1
0
        public void YouCanGetTheArgumentsOfCallsToAMethod()
        {
            // Create a stub.
            ISampleClass stub = CreateStub();

            // Call some methods.
            stub.MethodThatReturnsInteger("foo");
            stub.MethodThatReturnsInteger("bar");

            // GetArgumentsForCallsMadeOn() returns a list of arrays that contain
            // the parameter values for each call to the method.
            IList <object[]> argsPerCall = stub.GetArgumentsForCallsMadeOn(s => s.MethodThatReturnsInteger(null));

            argsPerCall[0][0].Should(Be.EqualTo("foo"));
            argsPerCall[1][0].Should(Be.EqualTo("bar"));
        }