C # that works like JUnit in Eclipse?

I come from the Java / Eclipse background, and I'm afraid I'm spoiled by how easy it is to get JUnit and JMock working in Eclipse and display this GUI with a panel and get information about skipping / crashing. It just works without the hassle.

I see many great features for testing in C # with Visual Studio. NUnit looks very good because it contains a unit and a testing layout in one. The problem is that I cannot figure out how to get the IDE to display my results. The NUnit documentation seems to show that it does not automatically show results through the VS IDE. I found http://testdriven.net/ which seems to blow, which makes VS display these statistics and work with multiple frameworks, but it is not open source.

Is there any way to get unit and false testing of working with VS IDE, as it happens in Java with Eclipse?

+7
c # unit-testing junit mocking
source share
5 answers

When you install NUnit, you get NUnit.exe - use this to open and run tests. It has a user interface and shows skip / failure and shows output.

You can add the build action in Visual Studio, which will be built in a specific testing configuration, and then immediately call NUnit in this DLL.

EDIT: (more)

In the test project:

  • Project Properties -> Debugging (build configuration configuration - I use "NUnitDebug")
  • Run action → "Run external program": C: \ Program Files \ NUnit 2.5.3 \ bin \ net-2.0 \ nunit.exe (use your own path)
  • Startup Parameters -> Command Line Arguments: MyTestProject.dll (replace the name of your DLL)

EDIT2: As Brendan said, Moq is a good layout that you can use.

+6
source share

Resharper allows you to do this and has a nice user interface. I believe that the core of this is NUnit. For fictitious material, you want to use Moq .

Resharper is not free / open source, but worth it.

+2
source share

If you are looking for something like Eclipse / JUnit, you should not have tried the Microsoft product line.

But the good news is that SharpDevelop has such nice integration with NUnit, and it's open source. However, it is aimed as an alternative to VS, not an add-on for VS.

+1
source share

You can read the ASP.NET MVC Test Framework Integration Walkthrough and run the tests from the VS test runner.

+1
source share

Have you tried using test projects in Visual Studio? They are almost identical to nUnit, and you can start them just by pressing F5.

To mock, choose what suits you, we look at Moq support for Silverlight.

0
source share

All Articles