Esempio n. 1
0
        static void thatCaptureAllArgumentsForTheVerifiedMethods()
        {
            // Given
            fflib_ApexMocks mocks      = new fflib_ApexMocks();
            fflib_MyList    mockList   = (fflib_MyList)mocks.mock(typeof(fflib_MyList));
            List <string>   stringList = new List <string> {
                "3"
            };

            // When
            mockList.add("Fred");
            mockList.add(stringList);
            mockList.clear();

            // Then
            fflib_ArgumentCaptor argument = fflib_ArgumentCaptor.forClass(typeof(string));

            ((fflib_MyList.IList)mocks.verify(mockList)).add((string)argument.capture());
            ((fflib_MyList.IList)mocks.verify(mockList)).add((List <string>)argument.capture());
            System.assertEquals(stringList, (List <string>)argument.getValue(), "the argument captured is not as expected");
            List <object> argsCaptured = argument.getAllValues();

            System.assertEquals(2, argsCaptured.size(), "expected 2 argument to be captured");
            System.assertEquals("Fred", (string)argsCaptured[0], "the first value is not as expected");
        }