문제

I would like to say the following with gmock:

Method A should be called twice, once with parameter X and the second time with parameter Y. Than the method should not be called again.

I know how to do the first part, but how i say that the method should never be called again?

도움이 되었습니까?

해결책

{
  InSequence s;
  EXPECT_CALL(mock, Method("X"));
  EXPECT_CALL(mock, Method("Y"));
}

Once these two calls are received, further calls to Method will generate errors.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top