Contains helpers for testing the Google Cloud C++ Client Libraries.
The symbols defined in this namespace are part of google-cloud-cpp's public API. Application developers may use them when mocking the client libraries in their own tests.
Functions
CurrentOptions
Retrieve options used in a client call.
This would be used to verify configuration options from within a MockConnection. It provides a way for applications to test the difference between client.Foo(request, options) and client.Foo(request).
TEST(Foo, CallOptions) {
auto mock = std::make_shared<MockConnection>();
EXPECT_CALL(*mock, Foo).WillOnce([] {
auto const& options = google::cloud::mocks::CurrentOptions();
EXPECT_THAT(options, ...);
});
auto client = Client(mock);
MyFunctionThatCallsFoo(client);
}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-03-05 UTC."],[[["The content provides access to various versions of the Google Cloud C++ Client Libraries, with version 2.37.0-rc being the latest release candidate."],["This section of the documentation pertains to helpers specifically designed for testing these Google Cloud C++ Client Libraries, focusing on mocks and testing functionality."],["A function named `CurrentOptions` is available to help developers retrieve the configuration options used within a client call, which can be very useful when developing and running tests."],["The `MakeStreamRange` function allows developers to create a `StreamRange\u003cT\u003e` for testing purposes, including the ability to specify a sequence of values and a final status for the stream."],["The documentation provides details about the `MakeStreamRange` function's parameters, including how to define the values to be returned and the final status of the stream."]]],[]]