protected string Call(string functionName, params string[] parameters) { var parametersWithPath = new List <string>(); if (GridPath != null) { parametersWithPath.Add(GridPath); parametersWithPath.Add(RowIndex.ToString()); } parametersWithPath.Add(Path); parametersWithPath.AddRange(parameters); const int maxRetry = 10; const int sleepInterval = 500; for (var i = 0; i < maxRetry; i++) { try { return(Silvernium.Call(functionName, parametersWithPath.ToArray())); } catch (SeleniumException) { if (i < maxRetry) { Thread.Sleep(sleepInterval); } else { throw; } } } return(null); }
protected Condition PathPresentCondition(string gridPath, int rowIndex, string path) { return(delegate { var invocationResult = Silvernium.Call("FindControl", gridPath, rowIndex.ToString(), path); return invocationResult != "null"; }); }
protected Condition PathPresentCondition(string path) { return(delegate { var invocationResult = Silvernium.Call("FindControl", path); return invocationResult != "null"; }); }
public void ShouldCommunicateWithSilverNibbleApplication() { Assert.AreEqual("SilverNibbles", selenium.GetTitle()); // verifies default properties in the silverlight object Assert.AreEqual(640, silvernium.ActualWidth()); Assert.AreEqual(460, silvernium.ActualHeight()); // verifies user defined properties and methods // content.SilverNibbles.StartingSpeed;, returns 5 Assert.AreEqual("5", silvernium.GetPropertyValue("StartingSpeed")); // content.SilverNibbles.NewGame('1');, returns null Assert.AreEqual("null", silvernium.Call("NewGame", "1")); // testing set and get for a user defined property Assert.AreEqual("5", silvernium.GetPropertyValue("StartingSpeed")); // setting the property silvernium.SetPropertyValue("StartingSpeed", "8"); // getting it again Assert.AreEqual("8", silvernium.GetPropertyValue("StartingSpeed")); }