I had a unit tests which constructed a pack uri, and I didn’t want to abstract it (needless abstraction) so here is how I solved a few issues.
System.UriFormatException : Invalid URI: Invalid port specified
This one is pretty easy to fix, you can use the
PackUriHelper which registers a few things in it’s static ctor
System.NotSupportedException : The URI prefix is not recognized
This one is fixed by giving WPF the default resource assembly.
System.Windows.Application.ResourceAssembly = typeof(App).Assembly;
Now you should be able to unit tests around pack uri’s