Вопрос

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