Domanda

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?

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top