locked
Upgrade Test project to DNX RRS feed

  • Question

  • I am working on existing project on DNX 1.0.0-beta 6. Now I add an unit test project. It is default to .NET 4.5.2. I tried to add my existing project reference to the test project. However it failed because of different framework.

    So I decide to upgrade the unit test project to DNX as well. The thing is I still failed, it seems the unit test project doesn't support the process.

    ANybody has tried this before? If so could you please provide the steps, demo project is welcomed.

    Regards.

    Tuesday, January 19, 2016 2:16 AM

Answers

  • Hi Ardmore,

    I could repro this issue as yours, I couldn't add the web project as the reference of the unit test project.

    For example, for general class library project we want to test, we would add it as the reference of the unit test project, my understanding is that ASP.NET vNext was different from the general unit test project we create, it has his own way for the ASP.NET 5 project.

    I think you could also get some useful information here:

    http://forums.asp.net/t/2025040.aspx?Writing+Unit+Tests+with+ASP+NET+vNext

    We don't add the reference like the general app for the asp.net 5 project. 

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by ardmore Saturday, January 23, 2016 12:35 PM
    Friday, January 22, 2016 7:38 AM

All replies

  • Hi ardmore,

    It seems that the DNX has his own unit test project template, of course, we also need to install the specific tool singly.

    A sample for reference:

    http://blogs.msdn.com/b/webdev/archive/2015/08/06/unit-testing-with-dnx-asp-net-5-projects.aspx

    Is it the result what you want to get? ardmore:)

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, January 20, 2016 9:03 AM
  • NO!

    I want to right click the solution and add a unit test project. You can add it but you can't get DNX showing on the project root node\references.

    If you look at the working project, the structure likes:

    Wednesday, January 20, 2016 4:58 PM
  • Hi ardmore,

    Do you mean that you want to add the ASP.NET 5 web app as the reference of the unit test project?

    I couldn't add it in my side.

    Like this document here:

    http://xunit.github.io/docs/getting-started-dnx.html

    As of DNX RC 1, the Visual Studio tooling for class library projects will use the net451 and dotnet5.4 frameworks in your project.json file. Unit tests are an application*, not a class library, so you must use the dnx451 and dnxcore50 framework names when writing unit tests; otherwise, the xunit.runner.dnx dependency will cause package restore failures.

    It seems that it really has the requirement for the .Net Framework version.

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you.

    Microsoft does not control these sites and has not tested any software or information found on these sites;

    Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.

    There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Thursday, January 21, 2016 9:27 AM
  • [quote]Do you mean that you want to add the ASP.NET 5 web app as the reference of the unit test project?[/quote]

    Yes, I have a POCO class in the Model. I have to reference it in my unit test project. It seems DNX doesn't support it.

    Thursday, January 21, 2016 1:10 PM
  • Hi Ardmore,

    I could repro this issue as yours, I couldn't add the web project as the reference of the unit test project.

    For example, for general class library project we want to test, we would add it as the reference of the unit test project, my understanding is that ASP.NET vNext was different from the general unit test project we create, it has his own way for the ASP.NET 5 project.

    I think you could also get some useful information here:

    http://forums.asp.net/t/2025040.aspx?Writing+Unit+Tests+with+ASP+NET+vNext

    We don't add the reference like the general app for the asp.net 5 project. 

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by ardmore Saturday, January 23, 2016 12:35 PM
    Friday, January 22, 2016 7:38 AM
  • Perhaps the best way to test it inside the web application. Say we create a folder for unit test and the necessary test framework from NuGet.

    Do you agree it?

    Friday, January 22, 2016 12:14 PM
  • Yes, I agree with you. Ass the test framework from the NuGet package would be a good solution.

    For example, I often use this way for the NUnit test project.

    Thanks,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Saturday, January 23, 2016 3:14 AM