<p>Im trying to generate views in unit tests but i can't get around the missing VirtualPathProvider. Most viewengines use the VirtualPathProviderViewEngine base class that gets the provider from the current HostingEnvironment.</p>

<pre><code>protected VirtualPathProvider VirtualPathProvider {
    get {
        if (_vpp == null) {
            _vpp = HostingEnvironment.VirtualPathProvider;
        }
        return _vpp;
    }
    set {
        _vpp = value;
    }
}
</code></pre>

<p>In unit tests there is no HostingEnvironment, even if i create one there is no current VirtualPathProvider. </p>

<p>How can i workaround this problem? Do i have to create a custom FakeWebFormViewEngine?</p>

I tried to do this as well.  Unfortunately, it is not just the VirtualPathProvider (VPP) that is the problem.  The VPP is used to map the view or partial view to a physical path to determine the existance of the file.  Unfortunately, the ViewContext ends up with the virtualpath, not the physical path, so when the view is rendered the Builder uses properties of the HostingEvnironment which does not exist.
If you are using a version of Visual Studio with Testing, then you could use a Web Unit Test.  This will allow you to use the browser to call the URL and then parse the response to check for values.