PrivateObject Class

Allows test code to call methods and properties on the code under test that would be inaccessible because they are not public.

Namespace:  Microsoft.VisualStudio.TestTools.UnitTesting
Assembly:  Microsoft.VisualStudio.QualityTools.UnitTestFramework (in Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll)

Syntax

'Declaration
Public Class PrivateObject
'Usage
Dim instance As PrivateObject
public class PrivateObject
public ref class PrivateObject
public class PrivateObject

Remarks

The test generator creates most of the calls to these objects. The test generator creates code to wrap the private objects in a wrapper that allows access to the private object's members.

For a list of initial property values for an instance of the PrivateObject class, see the PrivateObject constructor.

This class represents the live non-public internal object in the system.

.NET Framework Security

Inheritance Hierarchy

System.Object
  Microsoft.VisualStudio.TestTools.UnitTesting.PrivateObject

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

PrivateObject Members

Microsoft.VisualStudio.TestTools.UnitTesting Namespace

Other Resources

How to: Test a Private Method