Language: C#
Silverlight Unit Test with time for the UI to update
/// <summary> /// Holds up the test execution for the given duration without blocking the UI thread. /// </summary> void UIPause(int sec) { Storyboard PauseSB = new Storyboard() { Duration = new Duration(new TimeSpan(0, 0, sec)) }; PauseSB.Completed += (sender, e) => { TestComplete(); }; PauseSB.Begin(); } [TestMethod] [Asynchronous] public void SampleTest() { this.TestPanel.Children.Add(new Button()); UIPause(50); }
Tags:
silverlight, silverlight4, unit test, test, testing, unittest, ui, dispatcher, pause, sleep, control
Description:
When you run Presentation Tests for Silverlight controls the tests run so fast, that the ui doesn't have time to update.
This code gives you a method hold up the test for a given time (without blocking the ui thread) to actually see the test results on the Test Panel.
(I use the unit testing framework in Silverlight Toolkit.)
This code gives you a method hold up the test for a given time (without blocking the ui thread) to actually see the test results on the Test Panel.
(I use the unit testing framework in Silverlight Toolkit.)
Report Abuse
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search

