I'm looking for a way to extend a piece of user code.
A short description of the problem and solution so far:
I want to verify the contents of a cell in a table.
First attempt was without user code. That worked fine when there is something in that cell.
But... then I noticed that when the cell was empty, its value was actually (null).
So, I created the following user code (variables and repository items anonimised; sorry if I created unusable code in doing so):
Public Sub VerifyCellValue() ' If the cell is empty, we expect "", but the actual content of the cell is (null) If (ExpectedValue = "") Then Report.Log(ReportLevel.Info, "Validation", "Validating AttributeEqual (Text='(null)') on item 'Repo.CellContents'.",repo.Repo.CellContents) Validate.Attribute(repo.Repo.CellContents, "Text", (DirectCast(Nothing, String))) Else ' In all other cases, just validate if the expected and found text matches Report.Log(ReportLevel.Info, "Validation", "Validating AttributeEqual (Text=$ExpectedValue) on item 'Repo.CellContents'.", repo.Repo.CellContents) Validate.Attribute(repo.Repo.CellContents, "Text", ExpectedValue) End If End SubNo problems so far, works like a charm.
But... when I continued testing, using this code, it turns out that in SOME cases, if a cell is empty, its value is not (null), but “”.

This means I need some extra code within the If/Then branch. The Else branch is OK the way it is. For the If branch, if I expect an empty cell, I am happy when the internal value is either (null) or “”.
So, within the If-branch I want to handle a check against (null); if that matches, then the test case is OK; if it fails, try a match against "". If that matches, the test is still OK. If that fails, the test should fail.
I don't know how to do this, though. The Validate doesn't return any value, it just sets the testcase to failed somewhere deep in the Ranorex framework.
I hope there is some other method than the Validate; one that helps me to achieve this.
And I hope someone can point me in the direction of that method, or give me some other ideas on how to handle this.