C# 클래스 NFluent.Helpers.IsInstanceHelper

Helper class related to Is(Not)Instance methods (used like a traits).
파일 보기 프로젝트 열기: tpierrain/NFluent

공개 메소드들

메소드 설명
BuildErrorMessage ( object value, Type typeOperand, bool isSameType ) : string

Builds the error message related to the type comparison. This should be called only if the test failed (no matter it is negated or not). Warning: Should not call this method with nullable types. Indeed, the Nullable types are treated specially by CLR and it is impossible to have a boxed instance of a nullable type. Instead, boxing a nullable type will result in a null reference (if HasValue is false), or the boxed value (if there is a value).

BuildErrorMessageForNullable ( Type instanceType, Type expectedType, object value, bool isSameType ) : string
InheritsFrom ( IChecker checker, Type expectedBaseType ) : void

Checks that an instance is in the inheritance hierarchy of a specified type.

IsDifferentType ( Type instanceType, Type expectedType, object value ) : void

Checks that a type is not the expected one.

IsInstanceOf ( object instance, Type expectedType ) : void

Checks that an instance is of the given expected type.

IsNotInstanceOf ( object instance, Type typeNotExpected ) : void

Checks that an instance is not of the given expected type.

IsSameType ( Type instanceType, Type expectedType, object value ) : void

Checks that a type is the same as the expected one.

메소드 상세

BuildErrorMessage() 공개 정적인 메소드

Builds the error message related to the type comparison. This should be called only if the test failed (no matter it is negated or not). Warning: Should not call this method with nullable types. Indeed, the Nullable types are treated specially by CLR and it is impossible to have a boxed instance of a nullable type. Instead, boxing a nullable type will result in a null reference (if HasValue is false), or the boxed value (if there is a value).
public static BuildErrorMessage ( object value, Type typeOperand, bool isSameType ) : string
value object The checked value.
typeOperand System.Type The other type operand.
isSameType bool A value indicating whether the two types are identical or not. true if they are equal; false otherwise.
리턴 string

BuildErrorMessageForNullable() 공개 정적인 메소드

public static BuildErrorMessageForNullable ( Type instanceType, Type expectedType, object value, bool isSameType ) : string
instanceType System.Type
expectedType System.Type
value object
isSameType bool
리턴 string

InheritsFrom() 공개 정적인 메소드

Checks that an instance is in the inheritance hierarchy of a specified type.
The instance is not in the inheritance hierarchy of the specified type.
public static InheritsFrom ( IChecker checker, Type expectedBaseType ) : void
checker IChecker The instance to be checked.
expectedBaseType System.Type The Type which is expected to be a base Type of the instance.
리턴 void

IsDifferentType() 공개 정적인 메소드

Checks that a type is not the expected one.
public static IsDifferentType ( Type instanceType, Type expectedType, object value ) : void
instanceType System.Type The type of the instance to be checked.
expectedType System.Type The expected type for the instance to be checked.
value object The value of the instance to be checked (may be a nullable instance).
리턴 void

IsInstanceOf() 공개 정적인 메소드

Checks that an instance is of the given expected type.
The instance is not of the expected type.
public static IsInstanceOf ( object instance, Type expectedType ) : void
instance object The instance to be checked.
expectedType System.Type The expected type.
리턴 void

IsNotInstanceOf() 공개 정적인 메소드

Checks that an instance is not of the given expected type.
The instance is of the type not expected.
public static IsNotInstanceOf ( object instance, Type typeNotExpected ) : void
instance object The instance to be checked.
typeNotExpected System.Type The type not expected.
리턴 void

IsSameType() 공개 정적인 메소드

Checks that a type is the same as the expected one.
public static IsSameType ( Type instanceType, Type expectedType, object value ) : void
instanceType System.Type The type of the instance to be checked.
expectedType System.Type The expected type for the instance to be checked.
value object The value of the instance to be checked (may be a nullable instance).
리턴 void