i have the following in a handler where i get hold of the session to retrieve and update the customer object, is there a way we can unit test (mock) these 2 lines of code ?, i might have missing something but the documentation did not contain any samples on how unit test these, any links or guidance would be really helpfull.
var session = context.SynchronizedStorageSession.CosmosPersistenceSession();
var queryable = session.Container.GetItemLinqQueryable<Customer>(true);
var cust= session.Container.GetItemLinqQueryable<Customer>(true).Where(x => x.CustomerTenantId == CustomerId).FirstOrDefault();
The package contains a class called TestableCosmosSynchronizedStorageSession. You can use that to fake the synchronized storage session. Here is a test that demonstrates it.
From there you can use your preferred way of faking or mocking the container access. Container provides most of the methods as virtual members. You can override them manually or use a faking/mocking library of your choice.
We usually prefer hand rolled fakes. For example see