ClassCompareUtils
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:
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
public static bool ImageCompare(Bitmap imageA, Bitmap imageB, Rectangle selectionArea, int tolerance)
Parameters
imageA
The first image to compare
imageB
The second image to compare
selectionArea
An area within the image to compare. Pass in Rectangle.Empty if you want to compare the entire image
tolerance
The % tolerance of difference between the two images.
Returns
Returns true/false on whether the images match or not.
ImageExactCompare(Bitmap, Bitmap)
Validate whether two images are exactly the same.
NumberCompare(double, double, NumberCompareType)
Do numerical comparison
Declaration
public static bool NumberCompare(double leftPortion, double rightPortion, NumberCompareType compareType)
Parameters
leftPortion
Left side
rightPortion
Right side
compareType
The compare type.
Returns
True/False whether the compare passed
NumberCompare(double, double, NumberCompareType, double)
Do numerical comparison
Declaration
public static bool NumberCompare(double leftPortion, double rightPortion, NumberCompareType compareType, double delta)
Parameters
leftPortion
Left side
rightPortion
Right side
compareType
The compare type.
delta
How close the value must be to be accepted as a match.
Returns
True/False whether the compare passed
NumberCompare(int, int, NumberCompareType)
Do numerical comparison
Declaration
public static bool NumberCompare(int leftPortion, int rightPortion, NumberCompareType compareType)
Parameters
leftPortion
Left side
rightPortion
Right side
compareType
The compare type.
Returns
True/False whether the compare passed
NumberCompareRange(int, int, int, NumberRangeCompareType)
Do numerical range comparison.
Declaration
public static bool NumberCompareRange(int number, int lowerEnd, int upperEnd, NumberRangeCompareType compareType)
Parameters
number
The number to compare.
lowerEnd
The lower end of the range.
upperEnd
The upper end of the range.
compareType
The compare type.
Returns
True/False whether the comparison passed.
StringCompare(string, string, FindCompareType)
Perform a string comparison
Declaration
public static bool StringCompare(string a, string b, FindCompareType compareType)
Parameters
a
The first string.
b
The string to compare to.
compareType
The comparison type.
Returns
True/False whether the comparison passed
StringCompare(string, string, StringCompareType)
Perform a string comparison
Declaration
public static bool StringCompare(string a, string b, StringCompareType compareType)
Parameters
a
The first string.
b
The string to compare to.
compareType
The comparison type.
Returns
True/False whether the comparison passed