From Zero To NUnit With Visual Studio Code

I have a new Linux laptop and I wanted to run C# code. I had no idea where to start. I last wrote C# for money in 2004. It took me over an hour of hunting to figure out how to run a single test, so I decided to write a tutorial that could help someone else go from zero to NUnit with Visual Studio Code.

This is a companion discussion topic for the original entry at

Dear codewhisperer,
I found thistregarding the paragraph

I believe that I only have one entry point, so I tried for a few minutes to figure out this message, but I gave up due to not finding anything simple and straightforward to read. Instead, I now simply remove Program.cs and replace it with the code that I want to run, which contains tests

It mentions that xUnit injects its own main method that it tries to run. When this happens poof you have 2. You need to add special xml to your csharp.csproj to prevent this from happening.

Great post, thanks, I found it very useful. It would be even better to have the source code. Is it on github somewhere? Also, probably a good idea to put -L in your curl command to download the .gitignore (I think they moved it).

1 Like

Thank you, Dave. I’ve added -L to that curl command, since indeed, gitignore seems to have moved.

Regarding having the source code, since there isn’t really any code as such, but rather just a bunch of libraries, how would it help you to have the source code? I don’t think I’m prepared to maintain a starter project template. :slight_smile: I would worry that a starter project template would discourage people from learning how to do it, which makes them less resilient when the details change. I don’t want to be punished for trying to do a good deed. :slight_smile: