Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Using TestServer to test MVC Views Fails with missing assembly refs #5826

Closed
ardalis opened this issue Feb 19, 2017 · 5 comments
Closed

Using TestServer to test MVC Views Fails with missing assembly refs #5826

ardalis opened this issue Feb 19, 2017 · 5 comments

Comments

@ardalis
Copy link
Contributor

ardalis commented Feb 19, 2017

Repro Steps:

  1. Load the Docs repo
  2. Open this project:
    https://github.com/aspnet/Docs/tree/master/aspnetcore/mvc/controllers/testing/sample/TestingControllersSample
  3. Upgrade to .csproj - should migrate without issues
  4. Run tests

You will get two failing tests for integration tests hitting MVC Views that worked previously. Examining the response returned shows it's a Razor Compilation issue.

I haven't found a workaround that will get these views to build properly from a separate integration test project (as they used to do in 1.0).

This may be related: https://developercommunity.visualstudio.com/content/problem/17274/razor.html @NTaylorMullen

Or this: #4818 (comment)
@pranavkm

I'd like to update this doc sample for VS2017 but am currently blocked until I can figure this out.

@dougbu
Copy link
Member

dougbu commented Mar 7, 2017

@ardalis have you made progress here?

If not, have a look at the workarounds Mvc uses for its own functional tests i.e. see https://github.com/aspnet/Mvc/blob/dev/test/Microsoft.AspNetCore.Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj

@Eilon
Copy link
Member

Eilon commented Mar 21, 2017

I think this is a dup of #3410.

@ardalis
Copy link
Contributor Author

ardalis commented Mar 30, 2017

@dougbu No this still is failing. In the test the response for any MVC View result throws all kinds of namespace not found errors from Razor, for example:

The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

I tried adding workarounds from the .csproj file you reference but so far no luck (and I'm not sure which ones were supposed to help).

Do you have a minute to look at this project on my branch and see if you can help?
https://github.com/aspnet/Docs/tree/ardalis/testing-controllers-update/aspnetcore/mvc/controllers/testing/sample/TestingControllersSample

@dougbu
Copy link
Member

dougbu commented Mar 30, 2017

@ardalis I'm wrapping up for the day soon. But, I suspect you've grabbed 1.2.0 workarounds and tried to use them in a 1.0.x world. Have a look at https://github.com/aspnet/Mvc/tree/rel/1.0.3/test/Microsoft.AspNetCore.Mvc.FunctionalTests instead.

@ardalis
Copy link
Contributor Author

ardalis commented Mar 30, 2017

@dougbu No worries. Perhaps tomorrow. That branch is pre-CSPROJ/VS2017, which is what I'm on.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants