C# 클래스 Gtd.CoreDomain.Tests.CompareObjects

Class that allows comparison of two objects of the same type to each other. Supports classes, lists, arrays, dictionaries, child comparison and more. Source code is taken from http://comparenetobjects.codeplex.com/ All rights are reserved for the author.
파일 보기 프로젝트 열기: beingtheworst/btw-gtd 1 사용 예제들

공개 메소드들

메소드 설명
ClearCache ( ) : void

Reflection properties and fields are cached. By default this cache is cleared automatically after each compare.

Compare ( object object1, object object2 ) : bool

Compare two objects of the same type to each other.

Check the Differences or DifferencesString Properties for the differences. Default MaxDifferences is 1 for performance

CompareObjects ( ) : System

Set up defaults for the comparison

FindDifferences ( object expected, object actual ) : string

비공개 메소드들

메소드 설명
AddBreadCrumb ( string existing, string name, string extra, int index ) : string

Add a breadcrumb to an existing breadcrumb

AddBreadCrumb ( string existing, string name, string extra, string index ) : string

Add a breadcrumb to an existing breadcrumb

Compare ( object object1, object object2, string breadCrumb ) : void

Compare two objects

CompareClass ( object object1, object object2, string breadCrumb ) : void

Compare the properties, fields of a class

CompareEnum ( object object1, object object2, string breadCrumb ) : void

Compare an enumeration

CompareIDictionary ( object object1, object object2, string breadCrumb ) : void

Compare a dictionary

CompareIList ( object object1, object object2, string breadCrumb ) : void

Compare an array or something that implements IList

CompareIndexer ( PropertyInfo info, object object1, object object2, string breadCrumb ) : void
ComparePointer ( object object1, object object2, string breadCrumb ) : void

Compare a pointer struct

CompareSimpleType ( object object1, object object2, string breadCrumb ) : void

Compare a simple type

CompareStruct ( object object1, object object2, string breadCrumb ) : void

Compare a struct

CompareTimespan ( object object1, object object2, string breadCrumb ) : void

Compare a timespan struct

GetFieldInfo ( Type type ) : IEnumerable
GetPropertyInfo ( Type type ) : IEnumerable
IgnoredByAttribute ( Type type ) : bool

Check if any type has attributes that should be bypassed

IsArray ( Type t ) : bool
IsChildType ( Type t ) : bool
IsClass ( Type t ) : bool
IsEnum ( Type t ) : bool
IsIDictionary ( Type t ) : bool
IsIList ( Type t ) : bool
IsPointer ( Type t ) : bool
IsSimpleType ( Type t ) : bool
IsStruct ( Type t ) : bool
IsTimespan ( Type t ) : bool
IsValidIndexer ( PropertyInfo info, string breadCrumb ) : bool
PerformCompareFields ( Type t1, object object1, object object2, string breadCrumb ) : void

Compare the fields of a class

PerformCompareProperties ( Type t1, object object1, object object2, string breadCrumb ) : void

Compare the properties of a class

ValidStructSubType ( Type t ) : bool
cStr ( object obj ) : string

Convert an object to a nicely formatted string

메소드 상세

ClearCache() 공개 메소드

Reflection properties and fields are cached. By default this cache is cleared automatically after each compare.
public ClearCache ( ) : void
리턴 void

Compare() 공개 메소드

Compare two objects of the same type to each other.
Check the Differences or DifferencesString Properties for the differences. Default MaxDifferences is 1 for performance
public Compare ( object object1, object object2 ) : bool
object1 object
object2 object
리턴 bool

CompareObjects() 공개 메소드

Set up defaults for the comparison
public CompareObjects ( ) : System
리턴 System

FindDifferences() 공개 정적인 메소드

public static FindDifferences ( object expected, object actual ) : string
expected object
actual object
리턴 string