Table of Contents

Class TypeNameDifferenceResolver

Namespace
NUnit.Framework.Internal
Assembly
nunit.framework.dll

Used for resolving the type difference between objects.

public class TypeNameDifferenceResolver
Inheritance
TypeNameDifferenceResolver
Inherited Members

Constructors

TypeNameDifferenceResolver()

public TypeNameDifferenceResolver()

Methods

FullyShortenTypeName(Type)

Obtain a shortened name of the given Type.

public string FullyShortenTypeName(Type genericType)

Parameters

genericType Type

Returns

string

GetGenericTypeName(Type)

Returns the fully qualified generic Type name of a given Type.

public string GetGenericTypeName(Type type)

Parameters

type Type

Returns

string

GetShortenedGenericTypes(Type, Type, out string, out string)

Obtain the shortened generic Type names of the given expected and actual Types.

public void GetShortenedGenericTypes(Type expected, Type actual, out string shortenedGenericNameExpected, out string shortenedGenericNameActual)

Parameters

expected Type

The expected Type.

actual Type

The actual Type.

shortenedGenericNameExpected string

The shortened expected generic name.

shortenedGenericNameActual string

The shortened actual generic name.

IsTypeGeneric(Type)

Returns whether or not the Type is generic.

public bool IsTypeGeneric(Type type)

Parameters

type Type

Returns

bool

ReconstructGenericTypeName(string, List<string>)

Reconstruct a generic type name using the provided generic type name, and a List<T> of the template parameters.

public string ReconstructGenericTypeName(string genericTypeName, List<string> templateParamNames)

Parameters

genericTypeName string

The name of the generic type, including the number of template parameters expected.

templateParamNames List<string>

A List<T> of names of the template parameters of the provided generic type.

Returns

string

ResolveTypeNameDifference(object, object, out string, out string)

Gets the shortened type name difference between expected and actual.

public void ResolveTypeNameDifference(object expected, object actual, out string expectedTypeShortened, out string actualTypeShortened)

Parameters

expected object

The expected object.

actual object

The actual object.

expectedTypeShortened string

Output of the unique type name for the expected object.

actualTypeShortened string

Output of the unique type name for actual object.

ResolveTypeNameDifference(Type, Type, out string, out string)

Gets the shortened type name difference between expected and actual.

public void ResolveTypeNameDifference(Type expected, Type actual, out string expectedTypeShortened, out string actualTypeShortened)

Parameters

expected Type

The expected object Type.

actual Type

The actual object Type.

expectedTypeShortened string

Output of the unique type name for the expected object.

actualTypeShortened string

Output of the unique type name for actual object.

ShortenTypeNames(Type, Type, out string, out string)

Shorten the given Type names by only including the relevant differing namespaces/types, if they differ.

public void ShortenTypeNames(Type expectedType, Type actualType, out string expectedTypeShortened, out string actualTypeShortened)

Parameters

expectedType Type

The expected Type.

actualType Type

The actual Type.

expectedTypeShortened string

The shortened expected Type name.

actualTypeShortened string

The shortened actual Type name.