Microsoft Silverlight Unit testing framework can I inject javascript file into the test page
I want to write some test开发者_如何学Gos that involve communicating from javascript from Silverlight and I want to know if it is possible to inject javascript at runtime?
So in my test project I have the following method in the app.xaml file and I want to be able to dynamically include\insert some javascript.
private void Application_Startup(object sender, StartupEventArgs e)
{
RootVisual = UnitTestSystem.CreateTestPage();
}
Cheers
AWC
Do some research into
HtmlPage.Window.Eval(...)
http://msdn.microsoft.com/en-us/library/system.windows.browser.htmlwindow.eval(VS.95).aspx
Also, I wouldn't recommend setting up the Javascript within your Application_Startup — of course I don't know your requirements.
I would recommend placing it with in your test specific code. Or test setup and when done with the test, clean up any Javascript code you inject.
精彩评论