NancyFx/Nancy — pull request #1338 by phillip-haydon (2013-11-23 13:40:31+00:00)
Title: StartView being rendered for Partial Views when it shouldn't. 

I re-purposed the existing functional test views because I wanted to ensure they still ran with _ViewStart used.

Basically the `RazorPage.cshtml` no longer uses a `Layout`, it looks for `_ViewStart` which defines the `_LayoutPage` as the `Layout` to use. This is then what is loaded to the `RazorPage`

The `RazorPage` uses the `_PartialTest`.

The failing test looks to see if the string in the `_LayoutPage` is defined twice. A failing test shows:

![image](https://f.cloud.github.com/assets/895629/1606491/481ec79a-5444-11e3-8ca5-181614a12e8b.png)

Since it has found the string twice. This is because when a Partial View is rendered:

`var layout = view.HasLayout ? view.Layout : GetViewStartLayout(model, renderContext, referencingAssembly);`

This code would look for a ViewStart.

The fix is to specify at the HtmlHelper that its a partial view, this is then passed to the `RenderView` and then onto the `GetViewStartLayout`

I defined the check in the `GetViewStartLayout` since it makes the conditional operator too complicated.

This prevents the ViewStart being looked for when using Partials.