Pregunta

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?

¿Fue útil?

Solución

{
  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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top