के साथ एक WPF विंडो का परीक्षण करना मेरे पास App.xaml में एक StaticResource के संदर्भ के साथ एक साधारण विंडो है।StaticResources
App.xaml संसाधन परिभाषा:
<!-- Standard Text Box Style -->
<Style x:Key="textBoxStyleStd" TargetType="{x:Type TextBox}">
<Setter Property="FontSize" Value="14" />
</Style>
विंडो componets संसाधन का उपयोग कर:
System.Windows.Markup.XamlParseException: Cannot find resource named '{textBlockStyleStd}'. Resource names are case sensitive. Error at object 'stationIdTitle' in markup file 'Zpg;component/guicomponenets/screens/enterstationidscreen.xaml' Line 23 Position 71.
है:
<TextBlock Grid.Column="1" Grid.Row="0" Name="stationIdTitle"
Style="{StaticResource textBlockStyleStd}"
VerticalAlignment="Center" HorizontalAlignment="Center"
Text="{LocText Key=Title, Dict={StaticResource Dictionary},
Assembly={StaticResource Assembly}}"/>
इकाई परीक्षण करने की कोशिश कर जब यह विंडो मैं त्रुटि मिलती है इस के आसपास कोई रास्ता है? मेरा यूनिट टेस्ट कोड है:
[Test]
public void TestEnterKeyPressedNoText()
{
IPickingBusinessObject pickingBusinessObject = mock.StrictMock<IPickingBusinessObject>();
EnterStationIdScreen objectUnderTest = new EnterStationIdScreen(pickingBusinessObject);
Assert.AreEqual(Visibility.Visible, objectUnderTest.stationIdError.Visibility);
Assert.AreEqual("werwe", "oksdf");
Replay();
objectUnderTest.EnterKeyPressed();
Verify();
}
संभव समाधान StaticResource को डायनामिक रिसोर्स बाध्यकारी – Boogier