Angenommen, Sie dieses:google Mock - speichern EXPECT_CALL dann wiederverwenden und Klauseln ändern
EXPECT_CALL(MockClass_obj, f1(55)).Times(1);
// use the expectation
// ...
// Now clear it
Mock::VerifyAndClear(&MockClass_obj)
Ist es möglich, 1) Speichern Sie die Erwartung
UND
2) wiederverwenden es später und die Klauseln ändern?
Von here Ich weiß, es ist möglich, expectations
zu speichern, aber es gibt nirgendwo sonst, was darüber hinaus geht.
den obigen Code Bezug genommen, ich will, wie etwas zu tun ist:
Expecatation exp1 = EXPECT_CALL(MockClass_obj, f1(55)).Times(1);
// use the expectation
// ...
// Now clear it
Mock::VerifyAndClear(&MockClass_obj)
// Somehow modify exp1 to change the cardinality or any of the clauses
// so that I can make the test immediately readable and convey that it's very much related to the one above":
// Instead of this:
EXPECT_CALL(MockClass_obj, f1(55)).Times(0);
// I wanna do something like
exp1.Times(0)