title: How do I explicitly specify where a Nancy view is located?
body: <p>First of all I know what the problem is, I just don't know Nancy well enough to know how to fix it.</p>
  
  <p>I have a unit test failing when as part of the appharbor build process. The same test also fails when NCrunch executes it. But, when executed by VS2012 it works fine.</p>
  
  <p>The test looks like this:</p>
  
  <pre><code>[Test]
  public void Get_Root_Should_Return_Status_OK()
  {
      // Given
      var browser = new Browser(new Bootstrapper());
  
      // When
      var result = browser.Get("/");
  
      // Then
      Assert.AreEqual(HttpStatusCode.OK, result.StatusCode);
  }
  </code></pre>
  
  <p>HomeModule part handling the <code>"/"</code> route looks like this:</p>
  
  <pre><code>Get["/"] = _ =&gt; View["home.sshtml"];
  </code></pre>
  
  <p><code>home.sshtml</code> is in the Views folder.</p>
  
  <p>If I replace the above with:</p>
  
  <pre><code>Get["/"] = _ =&gt; "Hello World!;
  </code></pre>
  
  <p>Then the test goes green.</p>
  
  <p>So plainly the problem is that when running the test in NCrunch and appharbor the <code>home.sshtml</code> file cannot be found.</p>
  
  <p>How do I explicitly tell Nancy where the file is?</p>
  
  <p>PS The view file is being copied to the output directory.</p>
  
  <p>PPS I have also tried explicitly telling Nancy where the Views are like and that doesn't work either.</p>
  
  <pre><code>protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
  {
      var directoryInfo = new FileInfo(Assembly.GetExecutingAssembly().Location).Directory;
      if (directoryInfo != null)
          Environment.CurrentDirectory = directoryInfo.FullName;
      Conventions.ViewLocationConventions.Add((viewName, model, viewLocationContext) =&gt; String.Concat("Views/", viewName));
  }
  </code></pre>