Class
CompareUtils

Class to provide the most commonly used comparison types the framework can incorporate into a test.

Definition

Namespace:ArtOfTest.Common

Assembly:ArtOfTest.WebAii.dll

Syntax:

cs-api-definition
public static class CompareUtils

Inheritance: objectCompareUtils

Methods

ImageCompare(Bitmap, Bitmap, Rectangle, int)

Performs a compare of two images and returns whether they are the same within a specific tolerance.

Declaration

cs-api-definition
public static bool ImageCompare(Bitmap imageA, Bitmap imageB, Rectangle selectionArea, int tolerance)

Parameters

imageA

Bitmap

The first image to compare

imageB

Bitmap

The second image to compare

selectionArea

Rectangle

An area within the image to compare. Pass in Rectangle.Empty if you want to compare the entire image

tolerance

int

The % tolerance of difference between the two images.

Returns

bool

Returns true/false on whether the images match or not.

ImageExactCompare(Bitmap, Bitmap)

Validate whether two images are exactly the same.

Declaration

cs-api-definition
public static bool ImageExactCompare(Bitmap imageA, Bitmap imageB)

Parameters

imageA

Bitmap

The first image to compare

imageB

Bitmap

The second image to compare

Returns

bool

Whether the images match

NumberCompare(double, double, NumberCompareType)

Do numerical comparison

Declaration

cs-api-definition
public static bool NumberCompare(double leftPortion, double rightPortion, NumberCompareType compareType)

Parameters

leftPortion

double

Left side

rightPortion

double

Right side

compareType

NumberCompareType

The compare type.

Returns

bool

True/False whether the compare passed

NumberCompare(double, double, NumberCompareType, double)

Do numerical comparison

Declaration

cs-api-definition
public static bool NumberCompare(double leftPortion, double rightPortion, NumberCompareType compareType, double delta)

Parameters

leftPortion

double

Left side

rightPortion

double

Right side

compareType

NumberCompareType

The compare type.

delta

double

How close the value must be to be accepted as a match.

Returns

bool

True/False whether the compare passed

NumberCompare(int, int, NumberCompareType)

Do numerical comparison

Declaration

cs-api-definition
public static bool NumberCompare(int leftPortion, int rightPortion, NumberCompareType compareType)

Parameters

leftPortion

int

Left side

rightPortion

int

Right side

compareType

NumberCompareType

The compare type.

Returns

bool

True/False whether the compare passed

NumberCompareRange(int, int, int, NumberRangeCompareType)

Do numerical range comparison.

Declaration

cs-api-definition
public static bool NumberCompareRange(int number, int lowerEnd, int upperEnd, NumberRangeCompareType compareType)

Parameters

number

int

The number to compare.

lowerEnd

int

The lower end of the range.

upperEnd

int

The upper end of the range.

compareType

NumberRangeCompareType

The compare type.

Returns

bool

True/False whether the comparison passed.

StringCompare(string, string, FindCompareType)

Perform a string comparison

Declaration

cs-api-definition
public static bool StringCompare(string a, string b, FindCompareType compareType)

Parameters

a

string

The first string.

b

string

The string to compare to.

compareType

FindCompareType

The comparison type.

Returns

bool

True/False whether the comparison passed

StringCompare(string, string, StringCompareType)

Perform a string comparison

Declaration

cs-api-definition
public static bool StringCompare(string a, string b, StringCompareType compareType)

Parameters

a

string

The first string.

b

string

The string to compare to.

compareType

StringCompareType

The comparison type.

Returns

bool

True/False whether the comparison passed