Hi,
I have a simple Window with a reference to a StaticResource in the App.xaml
App.xaml resource definition
<!-- Standard Text Box Style -->
<Style x:Key="textBoxStyleStd" TargetType="{x:Type TextBox}">
<Setter Property="FontSize" Value="14" />
</Style>
Window componets using the resource
<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}}"/>
When trying to unit test this Window I get the error
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.
Is there any way around this? My unit test code is:
[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();
}
Cheers,
James