You create an application by using Microsoft Visual Studio .NET 2008 and the .NET Framework 3.5.
The application includes a class that contains several public methods that modify the object state.
Object state is encapsulated in private data members. You need to ensure that your unit tests meet the following requirements:
– Call public methods.
– Validate the expected behavior by checking the values of private data members.
– Fail to compromise object security or encapsulation.
What should you do?
A.
Replace private data members with public members.
B.
Use the publicize.exe utility to create a private accessor for the class library.
C.
Add the [AttributeUsageAttribute(AttributeTargets.Method, AllowMultiple = true)] decoration to the class.
D.
Add public methods to the class that can be called by unit tests to verify that the private data members provide expected values.