Class TypeNameDifferenceResolver
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
GetGenericTypeName(Type)
public string GetGenericTypeName(Type type)
Parameters
type
Type
Returns
GetShortenedGenericTypes(Type, Type, out string, out string)
public void GetShortenedGenericTypes(Type expected, Type actual, out string shortenedGenericNameExpected, out string shortenedGenericNameActual)
Parameters
expected
TypeThe expected Type.
actual
TypeThe actual Type.
shortenedGenericNameExpected
stringThe shortened expected generic name.
shortenedGenericNameActual
stringThe shortened actual generic name.
IsTypeGeneric(Type)
Returns whether or not the Type is generic.
public bool IsTypeGeneric(Type type)
Parameters
type
Type
Returns
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
stringThe 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
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
objectThe expected object.
actual
objectThe actual object.
expectedTypeShortened
stringOutput of the unique type name for the expected object.
actualTypeShortened
stringOutput 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
TypeThe expected object Type.
actual
TypeThe actual object Type.
expectedTypeShortened
stringOutput of the unique type name for the expected object.
actualTypeShortened
stringOutput 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)