How to test protected methods in singleton on C#?
Is that possible?
How to test protected methods in singleton on C#? Is that possible?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Singleton are always difficult to test, but if you want full control have a look at moles and pex. Moles enable you to test almost everything without doing any changes to the current implementation. If you really want to make testing easier, remove your global state (singleton), you probably do not need it anyway.
moles and pex
singleton anti pattern