I can suggest following code:
public static void imagesCompare (Bitmap expected, Bitmap actual, String success, String error) {
if (Imaging.Compare (expected, actual)==1)
Report.Success (success);
else {
Report.Failure (error);
Report.LogData (ReportLevel.Error, "Expected", expected);
Report.LogData (ReportLevel.Error, "Actual", actual);
}
}
Bitmap current = Imaging.CaptureImage (repo.FormOIS_WinStation_11_EyeSca.Element59648);
Bitmap image = Imaging.Load ("TC244.png");
imagesCompare (image, current, "TC244: correct image", "TC244: image is incorrect!");And instead of repo:
Bitmap current = Imaging.CaptureImage (repo.FormOIS_WinStation_11_EyeSca.Element59648);
You can use some like that:
Bitmap current = Imaging.CaptureImage (Element);
And you can generate Element in Runtime. See here for details:
http://www.ranorex.com/Documentation/Ranorex-2.0/html/M_Ranorex_Imaging_CaptureImage.htm