共用方式為


GenericParameterHelper Class

This class is a placeholder for use with generics. It helps you test generic types by letting you pass non-specific type arguments.

Inheritance Hierarchy

Object
  Microsoft.VisualStudio.TestTools.UnitTesting.GenericParameterHelper

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

Syntax

'Declaration
Public Class GenericParameterHelper _
    Implements IComparable, IEnumerable, ICloneable
public class GenericParameterHelper : IComparable, 
    IEnumerable, ICloneable
public ref class GenericParameterHelper : IComparable, 
    IEnumerable, ICloneable
type GenericParameterHelper =  
    class 
        interface IComparable 
        interface IEnumerable 
        interface ICloneable 
    end
public class GenericParameterHelper implements IComparable, IEnumerable, ICloneable

The GenericParameterHelper type exposes the following members.

Constructors

  Name Description
Public method GenericParameterHelper() Initializes a new instance of the GenericParameterHelper class. This constructor initializes the Data property to a random value.
Public method GenericParameterHelper(Int32) Initializes a new instance of the GenericParameterHelper class. This constructor initializes the Data property to a user specified value.

Top

Properties

  Name Description
Public property Data Gets or sets the Data property for this instance.

Top

Methods

  Name Description
Public method Clone Creates a new GenericParameterHelper that is a copy of the current instance.
Public method CompareTo Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
Public method Equals Determines whether the specified GenericParameterHelper object is equal to the current GenericParameterHelper object. (Overrides Object.Equals(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 GetEnumerator Returns an enumerator whose length is derived from the Data property.
Public method GetHashCode Returns the hash code for this GenericParameterHelper object. (Overrides Object.GetHashCode.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Remarks

A unit test might not be able to pass a real type to a generic method that it is testing. That code can pass this generic placeholder instead.

When the Team System testing tools generates a unit test for testing a generic type, the calls that test that generic type use placeholder generic type arguments.

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