title: Testing a WPF Window with StaticResources
body: <p>I have a simple Window with a reference to a StaticResource in the App.xaml.</p>
  
  <p>App.xaml resource definition:</p>
  
  <pre><code>&lt;!-- Standard Text Box Style --&gt;
  &lt;Style x:Key="textBoxStyleStd" TargetType="{x:Type TextBox}"&gt;
      &lt;Setter Property="FontSize" Value="14" /&gt;
  &lt;/Style&gt;
  </code></pre>
  
  <p>Window componets using the resource:</p>
  
  <pre><code>&lt;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}}"/&gt;
  </code></pre>
  
  <p>When trying to unit test this Window I get the error:</p>
  
  <blockquote>
    <p>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.</p>
  </blockquote>
  
  <p>Is there any way around this? My unit test code is:</p>
  
  <pre><code>[Test]
  public void TestEnterKeyPressedNoText()
  {
      IPickingBusinessObject pickingBusinessObject = mock.StrictMock&lt;IPickingBusinessObject&gt;();
  
      EnterStationIdScreen objectUnderTest = new EnterStationIdScreen(pickingBusinessObject);
  
      Assert.AreEqual(Visibility.Visible, objectUnderTest.stationIdError.Visibility);
  
      Assert.AreEqual("werwe", "oksdf");
  
      Replay();
  
      objectUnderTest.EnterKeyPressed();
  
      Verify();
  }
  </code></pre>