我是 GTest/Gmock 的新手。下面是一个类:
class HttpRequest
{
public:
std::string name;
std::vector<std::string> headers;
HttpRequest()
{
name = "HTTP"
headers.push_back( "ZERO" );
headers.push_back( "ONE" );
headers.push_back( "TWO" );
}
virtual ~HttpRequest();
}
当尝试使用下面的 EXPECT_CALL 函数使用 GTest/Gmock 验证此对象的成员时,如下所示,我收到错误error C2228: left of '.at' must have class/struct/union
EXPECT_CALL ( requestHandler, Send(
AllOf(Field(&HttpRequest::name, "HTTP"),
Field(&HttpRequest::headers.at(0), "ZERO")
)
)).Times(1);
任何输入/建议都会非常有帮助,谢谢。