Encapsulation.

Submitted By: admin on September 15, 2017

1

0

5081

Encapsulation. Source: www.reddit.com

1st: If consumers of your class can't access the setter, your test shouldn't either.

2nd: In some of the edge cases you can just use reflection (at least for properties)

3rd: For private methods if you REALLY REALLY need to access them in your test there are 2 options. 1st make the method internal and give your tests access to those internal methods or 2nd make the method protected and write a wrapper class to access it. :)

- HobHeartsbane

Site Comments (0)

Please Signin or Signup to add a comment