public static string GetPropertyName <TViewModel, TResult> (this SilverlightTest test, Expression <Func <TViewModel, TResult> > property) { string propertyName = ((MemberExpression)property.Body).Member.Name; return(propertyName); }
/// <summary> /// Initializes a new instance of the LiveReference class. /// </summary> /// <param name="element"> /// Element to add to the testing surface canvas. /// </param> public LiveReference(SilverlightTest silverlightTest, UIElement element) { _testBase = silverlightTest; Assert.IsNotNull(_testBase); Assert.IsNotNull(_testBase.TestPanel); Element = element; _testBase.TestPanel.Children.Add(Element); }
/// <summary> /// Requires a bool returning delegate to be passed in. Instructs the test task /// queue to wait until the conditional call returns True to continue executing /// other test tasks and/or ending the test method. /// </summary> /// <param name="test">Silverlight test class</param> /// <param name="condition">Conditional method or delegate. Test will halt until this condition returns True</param> /// <param name="seconds">Number of seconds before timeout expires. Pass Timeout.Infinite for no timeout.</param> public static void EnqueueConditional(this SilverlightTest test, Func <bool> condition, int seconds) { DateTime startTime = DateTime.Now; TimeSpan duration = TimeSpan.FromSeconds(seconds); test.EnqueueConditional(() => { if (seconds != Timeout.Infinite) { string message = string.Format("Condition not satisfied before timeout of {0} seconds", seconds); Assert.IsTrue(DateTime.Now < startTime.Add(duration), message); } return(condition()); }); }
/// <summary> /// Enqueue to step allow (for example) event handlers a chance to execute. /// </summary> /// <param name="test"></param> public static void EnqueueYieldThread(this SilverlightTest test) { test.EnqueueSleep(0); }
public AsynchronusTestContext(SilverlightTest test) { Test = test; }