This is a migrated thread and some comments may be shown as answers.

Validation of Object Properties

1 Answer 40 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
sitefinitysteve asked on 13 Oct 2010, 06:41 PM
Is there a way to validate an object to see if it contains a Property?

1 Answer, 1 is accepted

Sort by
0
Accepted
Cody
Telerik team
answered on 14 Oct 2010, 05:53 PM
Hello Steve,

If you're talking about HTML elements, it's an attribute. This can't be done using a normal verification, but can easily be done in a coded step. Use code to verify an attribute is simply present on an element:

bool found = false;
 
foreach (iAttribute attr in Pages.Bing.PreferencesLink.Attributes)
{
    if (attr.Name == "href")
    {
        found = true;
    }
}
Assert.IsTrue(found, "Attribut href not found");

For Silverlight elements you can use code like this:

Dictionary<string, string> props = Pages.TelerikTreeViewFor.SilverlightApp.InstallerTextblock.GetProperties();
Assert.IsTrue(props.ContainsKey("Text"));

Greetings,
Cody
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Answers by
Cody
Telerik team
Share this question
or