Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C# Unit Testing in C# Unit Testing xUnit.net Unit Test Framework

Radu - Adrian Buha
PLUS
Radu - Adrian Buha
Courses Plus Student 5,535 Points

In my opinion, this tutorial is no longer actual and it should be updated.

This tutorial no longer shows the proper way to install the Xunit framework on your testing project. I have tried the way Jeremy explains and got no success. After searching a solution on the internet i discovered that you have to manually create another project in your solution and in that project you have to install the Xunit framework along with it's dependencies (xunit.runner.console and xunit.runner.visualstudio).

Also, I was unable to automatically generate the Unit Test as Jeremy showed (right click on the target class and select "Create Unit Test". Each time a tried this option, in the Test Framework Tab I could only select the "MSTestv2 framework".

I understand that the IDE and the way that the IDE interacts with specific frameworks changes, but in my opinion, when significant changes occur, the tutorials should be updated.

Best of wishes, Radu

Steven Parker
Steven Parker
231,072 Points

The forum is a great place to get help from other students, but may not be the most expedient (or even certain) way to contact the staff.

The Support page describes how to report bugs directly to the staff.

2 Answers

Radu - Adrian Buha
PLUS
Radu - Adrian Buha
Courses Plus Student 5,535 Points

I did sent an e-mail to the Treehouse staff, but i also posted on the forum, because the other students should know about this issue. It's frustrating when you don't get the result you expect from following a tutorial.

Balazs Peak
Balazs Peak
46,160 Points

I don't understand why "xUnit" is put into a tutorial like this either. It is a poorly supported second class third party framework. For learning purposes, official MS unit testing is the only acceptable, people can learn third party frameworks in company specific tech stack learning environments.

Edit: I had some versioning issues with xUnit, .NET framework had to be updated if I'm remembering right. I dealt with it inside of Visual Studio. After the update xUnit worked fine for this tutorial. I will test it later in live projects.