| 
       Custom During Filters  | 
    Top Previous Next | 
| 
 Custom During Lambda Filter 
 Use custom lambda for conditions not covered by built-ins. The lambda sends a DuringContext argument that you can use. 
 DuringContext contains the following: 
 
 
 
 
 
 
 Here is an example for using GetThreadId: 
 TEST(DuringTests, FilterByThreadIdWithCustomLambda) { auto id = GetCurrentThreadId(); 
 auto a = Isolator(During([=](DuringContext& context) { return context.GetThreadId() == id; })); 
 auto fake = a.Fake.Instance<Person>(); 
 // This is restricted to getName called within current thread a.CallTo(fake->GetName()).WillReturn("John"); 
 auto res = fake->GetName(); ASSERT_TRUE(strcmp(res, "John") == 0); }    | 
Copyright Typemock Ltd. 2009-2025. All Rights Reserved.