Ignored Parameters |
Top Previous Next |
When using Isolator++ Professional, you don't need to specify exact parameter values when defining method behaviors. By disregarding parameters at runtime, tests become less fragile and do not require an exact setup, making them more resilient to code changes.
This approach is especially useful for functions with multiple arguments, as it improves test clarity and readability by focusing on behavior rather than specific input values.
You can use A::Any() to match any value of a given type, whether it's a primitive, pointer, compound type, enum, or reference. Use this when you don't care about the parameter values passed to the function.
TEST_F(Examples, IgnoredParameters) { // Arrange auto a = Isolator(); Person* livePerson = new Person();
a.CallTo(livePerson->Login(A::Any(),A::Any())).WillReturn(true);
// Act auto result = livePerson->Login("user","password");
// Assert ASSERT_TRUE(result); }
|
Copyright Typemock Ltd. 2009-2025. All Rights Reserved.