Error when running unit test on CustomContentTypeAvailabilityService (DefaultContentTypeAvailablilityService)

Vote:
 

Hi everyone, 
We have a custom class that inherit EPiServer.DataAbstraction.Internal.DefaultContentTypeAvailablilityService class.  



A unit test simply mock these 6 constructor's parameters and then call ListAvailable() method...  but this start with a crash on line 23 (using "base").  The error message is not clear (System.NullReferenceException).  In Rider it shows that it failed in DefaultContentTypeAvailablilityService.  It doesn’t seems to have a way to mock that as its the parent that do the job (not an interace)! 



Any Idea on how to fix that... wihout a big code refactoring!?   

I just found a post that maybe can apply also as a solution for me. That post mentionned "Perhaps you could implement your own ContentTypeAvailabilityService:" https://world.optimizely.com/forum/developer-forum/CMS/Thread-Container/2015/9/hide-blocktype-from-editmode-but-available-when-combined-with-allowedtypes/  

That could be my next try, but Im just trying to see if I am missing something before to go for a refactoring again... 
Thank you for any suggestion!

#291722
Nov 15, 2022 21:46
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.