共用方式為


PrivateType Class

Represents the type of a private class that gives access to private static implementations.

Inheritance Hierarchy

Object
  Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType

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

Syntax

'Declaration
Public Class PrivateType
public class PrivateType
public ref class PrivateType
type PrivateType =  class end
public class PrivateType

The PrivateType type exposes the following members.

Constructors

  Name Description
Public method PrivateType(Type) Initializes a new instance of the PrivateType class with the type information.
Public method PrivateType(String, String) Initializes a new instance of the PrivateType class.

Top

Properties

  Name Description
Public property ReferencedType Gets the Type representing the PrivateType.

Top

Methods

  Name Description
Public method Equals Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Serves as the default hash function. (Inherited from Object.)
Public method GetStaticArrayElement(String, array<Int32[]) Gets a static array element contained in the wrapped type.
Public method GetStaticArrayElement(String, BindingFlags, array<Int32[]) Gets a static array element contained in the wrapped type.
Public method GetStaticField(String) Gets a static field contained in the wrapped type.
Public method GetStaticField(String, BindingFlags) Gets a static field contained in the wrapped type.
Public method GetStaticFieldOrProperty(String) Gets a value of a static field or property in a wrapped type based on the name.
Public method GetStaticFieldOrProperty(String, BindingFlags) Gets a value of a static field or property in a wrapped type based on the name.
Public method GetStaticProperty(String, array<Object[]) Gets a static property contained in the wrapped type.
Public method GetStaticProperty(String, BindingFlags, array<Object[]) Gets a static property contained in the wrapped type.
Public method GetStaticProperty(String, BindingFlags, array<Type[], array<Object[]) Gets a static indexed property contained in the wrapped type.
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method InvokeStatic(String, array<Object[]) Invokes static methods on the PrivateType.
Public method InvokeStatic(String, array<Object[], CultureInfo) Invokes static methods on the PrivateType.
Public method InvokeStatic(String, BindingFlags, array<Object[]) Invokes static methods on the PrivateType.
Public method InvokeStatic(String, array<Type[], array<Object[]) Invokes static methods on the PrivateType.
Public method InvokeStatic(String, BindingFlags, array<Object[], CultureInfo) Invokes static methods on the PrivateType.
Public method InvokeStatic(String, BindingFlags, array<Type[], array<Object[]) Invokes static methods on the PrivateType.
Public method InvokeStatic(String, array<Type[], array<Object[], CultureInfo) Invokes static methods on the PrivateType.
Public method InvokeStatic(String, array<Type[], array<Object[], array<Type[]) Invokes static methods on the PrivateType.
Public method InvokeStatic(String, BindingFlags, array<Type[], array<Object[], CultureInfo) Invokes static methods on the PrivateType.
Public method InvokeStatic(String, BindingFlags, array<Type[], array<Object[], CultureInfo, array<Type[]) Invokes static methods on the PrivateType.
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method SetStaticArrayElement(String, Object, array<Int32[]) Sets a static array element contained in the wrapped type.
Public method SetStaticArrayElement(String, BindingFlags, Object, array<Int32[]) Sets a static array element contained in the wrapped type.
Public method SetStaticField(String, Object) Sets a static field contained in the wrapped type.
Public method SetStaticField(String, BindingFlags, Object) Sets a static field contained in the wrapped type.
Public method SetStaticFieldOrProperty(String, Object) Sets a static field or property contained in the wrapped type.
Public method SetStaticFieldOrProperty(String, BindingFlags, Object) Sets a static field or property contained in the wrapped type.
Public method SetStaticProperty(String, Object, array<Object[]) Sets a static property contained in the wrapped type.
Public method SetStaticProperty(String, Object, array<Type[], array<Object[]) Sets a static property contained in the wrapped type.
Public method SetStaticProperty(String, BindingFlags, Object, array<Object[]) Sets a static property contained in the wrapped type.
Public method SetStaticProperty(String, BindingFlags, Object, array<Type[], array<Object[]) Sets a static property contained in the wrapped type.
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Remarks

The test generator automatically creates the private type.

.NET Framework Security

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

Microsoft.VisualStudio.TestTools.UnitTesting Namespace

Other Resources

How to: Test a Private Method