I am trying to make this example of Silverlight UI testing work:
http://msmvps.com/blogs/theproblemsolver/archive/2009/01/26/unit-testing-in-silverlight-part-4-the-ui.aspx
The article is relatively old. I am using Silverlight 4 and VS2010. Everything works, except the last part of the example: comilation fails at this line:
TextBoxAutomationPeer textBoxPeer = new TextBoxAutomationPeer(_myControl.txtPhotoUrl());
Error 1 'SilverlightApplication9.MyControl' does not contain a definition for 'txtPhotoUrl' and no extension method 'txtP开发者_StackOverflow中文版hotoUrl' accepting a first argument of type 'SilverlightApplication9.MyControl' could be found (are you missing a using directive or an assembly reference?) c:\users\val\documents\visual studio 2010\Projects\SilverlightApplication9\SilverlightTest1\Tests.cs 39 86 SilverlightTest1
Do you know how to fix this by any chance?
Try removing the parentheses:
TextBoxAutomationPeer textBoxPeer = new TextBoxAutomationPeer(_myControl.txtPhotoUrl);
精彩评论