Class seems to obsolete now, but we are using it in lot of places in our projects. I can't see any way to write unit test cases to the methods containing carthelper implementation. It seems be connecting to dbcontext. Is there a way?
To moq CartHelper, you would need to create a Cart Helper wrapping class with a custom interface.
Note that CartHelper is not support when you upgrade to Commerce 13 so you would have to discard the unit tests you are writing now when you upgrade. Consider upgrading before writing the unit tests if possible.
I strongly suggest to take a look at this Quicksilver/CartService.cs at master · episerver/Quicksilver · GitHub and see if you can convert your code. Beside making your code more futureproof, it also means you get your unit tests with ease