The same line of code in the same assembly works for one test fixture but not another. Here is the line of code:
var dic = new ResourceDictionary { Source = new
@Prince Ashitaka answer tells you how to correct your URI
However the preferred way of accessing a ResourceDictionary is that in XAML you add it on as a merged dictionary
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ImageResources.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
then you can access it via code using the TryFindResource(string Key)
from any code behind file
What I use is with UriKind like
var resource = new ResourceDictionary
{
Source = new Uri("/myAssemblyName;component/Themes/generic.xaml",
UriKind.RelativeOrAbsolute)
};
HTH