Hi, @NewCodee
Welcome to Microsoft Q&A!
I created a project with reference to the code you provided, but the method (B obj) of class A will throw a compilation exception CS0051.
Can your code run before unit testing? According to this document, The return type and parameter types of a method must be at least as accessible as the method itself.
You can try to modify the access modifier of class B before unit testing.
Sincerely,
Peng
*
If you have extra questions about this answer, please click "Comment". If the answer is the right solution, please click "Accept Answer" and kindly upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.