我有一个 Windows 应用商店应用程序(C# + XAML)并想为它创建一些单元测试。我在我的解决方案中为此创建了单元测试项目,默认测试方法工作正常。然后我将我的项目添加为对单元测试项目的引用,并且测试停止工作:
------ Discover test started ------
========== Discover test finished: 1 found (0:00:00,8748072) ==========
------ Run test started ------
Updating the layout...
Copying files: Total 2 mb to layout...
Registering the application to run from layout...
Deployment complete. Full package name: "58d19822-a649-46ba-b3fd-36c60b2709d7_1.0.0.0_neutral__t4zwj4xd20b1w"
Failed to activate Windows Store app unit test executor. Error: The remote procedure call failed.
========== Run test finished: 0 run (0:00:05,0596667) ==========
我用谷歌搜索了很多,发现一个解释错误的线程可能在 App.xaml 中,实际上我可以将它追踪到这个 TextBlock:
<TextBlock Grid.ColumnSpan="2" controls:HighLightString.FullText="{Binding Path=FullName}" controls:HighLightString.SelectedText="{Binding DataContext.QueryText, ElementName=resultsPanel}" controls:HighLightString.FgColor="{StaticResource SAPHighlightColor}" Style="{StaticResource TileTitleTextStyle}" Margin="20,0,0,0" TextTrimming="WordEllipsis"/>
如果我将其更改为:
<TextBlock Grid.ColumnSpan="2" Text="{Binding Path=FullName}" Style="{StaticResource TileTitleTextStyle}" Margin="20,0,0,0" TextTrimming="WordEllipsis"/>
测试运行良好,但该文本块上不再有搜索突出显示。
我怎样才能同时拥有 - 搜索突出显示和在我的解决方案中运行单元测试?