Combined During Filters

Top  Previous  Next

Combining During Filters

 

You can combine filters at different levels (suite, instance, call).

All must succeed for the fake to apply.

 

TEST(DuringTests, MultipleDuringFiltersUsingAModuleAndAMemberAndAThreadSucceeded)

{

    auto a = Isolator(During(A::Module("Test.dll")));

 

    auto fake = a.Fake.Instance<Person>(During(A::Call(Person::GetName)));

 

    a.CallTo(fake->GetName())

     .During(A::Thread(GetCurrentThreadId()))

     .WillReturn("John");

 

    auto res = fake->GetName();

    ASSERT_TRUE(strcmp(res, "John") == 0);

}

 

 

Note: If you using custom filter, you can stop going up the levels using the IgnoreHigherLevels API.


Copyright  Typemock Ltd. 2009-2025.  All Rights Reserved.