开发者

Microsoft Silverlight Unit testing framework can I inject javascript file into the test page

开发者 https://www.devze.com 2022-12-26 16:16 出处:网络
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?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消