Can I somehow use "Validate" to validate the contents of a string, and NOT of a Ranorex object? I need to verify that each line of an XML document has the expected text.
So basically, I end up with 2 strings:
------------------------------------------
string expectedString = "US";
string fromXML = xmlDoc.SelectSingleNode("blabla", nameSpaceMgr).InnerText;
Now I simply need to verify that the 2 strings match.
-------------------------------------------------------------
Validate.??????(expectedString, fromXML); //How do I validate that they match?
Of course I can do If/Else, or using C#'s string.Compare, but this is not ideal, because:
* I have to verify a long document, so it would be more maintainable to have one-liner code for each validation.
* I also need the Ranorex script to fail if it does NOT match, so a Validate of some sort would make that easy to reduce lines of code for each check too.
Thanks!
Using of "Validate" for strings instead of Ranorex objects?
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Using of "Validate" for strings instead of Ranorex objects?
Hi,
to validate if two string are equal you can use following method:
AreEqual(Object, Object)
You code should look something like this:
Tobias
Ranorex Support Team
to validate if two string are equal you can use following method:
AreEqual(Object, Object)
You code should look something like this:
string expectedString = "US"; string fromXML = xmlDoc.SelectSingleNode("blabla", nameSpaceMgr).InnerText; Validate.AreEqual(expectedString, fromXML);Regards,
Tobias
Ranorex Support Team