nunit

Is there a free Visual Studio addin for Nunit?

I'm cheap and don't want to pay for ReSharper or TestDriven.NET, is there a free visual Studio addin for NUnit? ...

How do you test private methods with NUnit?

I am wondering how to use NUnit correctly. First i created a separate Test-Project that uses my main project as reference. But in that case i am not able to test private methods. My guess was that i need to include my testcode into my main code?! - That doesn't seem to be the correct way to do it. (I dislike the idea of shipping code wit...

Mock objects, nUnit, call log and log4net

A very often scenario of unit test is as follows: public void SetUp() { this.callLog = new StringBuilder(); } public void TestBuzzBar() { var bar = new Bar(new MockFoo(callLog)); bar.Buzz(17); Assert.AreEqual("MockFoo.Init(17) MockFoo.PrepareStuff MockFoo.DoTheJob ", callLog.ToString()); } ... with MockFoo implementing an IFo...

NUnit and Visual Web Developer 2008SP1 - Integration problems

Hey all, I've decided to integrate NUnit with VWD2008. I did the following- 1) Installed NUnit - Ran a Sample project that was included with the installation all the tests were fine. 2) Installed TestDriven.Net 2.0 - Personal distribution. 3) I have written on an MVC Project a test and when I try to right click the context and run the ...

Is NUnit's ExpectedExceptionAttribute only way to test if something raises an exception?

Hello, I'm completely new at C# and NUnit. In Boost.Test there is a family of BOOST_*_THROW macros. In Python's test module there is TestCase.assertRaises method. As far as I understand it, in C# with NUnit (2.4.8) the only method of doing exception test is to use ExpectedExceptionAttribute. Why should I prefer ExpectedExceptionAttri...

Replacement for NUnitAsp

Hi, Are there any replacements for NUnitAsp that anyone knows of for testing ASP.NET pages? ...

NUnit vs. MbUnit vs. MSTest vs. xUnit.net

There are quite a lot of unittesting frameworks out there for .NET. I found this little feature comparison: http://www.codeplex.com/xunit/Wiki/View.aspx?title=Comparisons Now I am to choose the best one for us. But how? Does it matter? Which one is most future proof and has a decent momentum behind it? Should I care about the features? ...

Weird nUnit unit test failure

I have classX: Sub New(ByVal item_line_no As String, ByVal item_text As String) ' check to ensure that the parameters do not exceed the file template limits Select Case item_line_no.Length Case Is > m_item_line_no_capacity Throw New ArgumentOutOfRangeException(item_line_no, "Line No exceeds 4 characters") ...

What is the best way to debug a NUnit test?

My platform: Visual C# 2008 Express Edition with NUnit 2.2.7 I have a solution with my code in one project and my NUnit unit tests in a different project in the same solution. I have been struggling hard to debug and single-step through the NUnit tests. I found some references online that suggested calling the following: NUnit.Consol...

Does Application.ExecutablePath return different values depending on the test runner?

I'm trying to see if there's a way to get a consistent unit test result across multiple test runners. The current situation is that we have a test assembly where 4 of the tests pass if you run them in NUnit GUI, but fail if you run them using TestDriven.NET or the ReSharper test runner. In the cases where these tests are failing (a Sys...

NCover Nunit CruiseControl.NET Task with NCover Addin

Can someone provide me a sample for a ncover task for a nunit dll? ...

How do I test if two dates are within a certain tolerance in NUnit?

How do I test if two dates are within a certain tolerance in NUnit? ...

Getting a version 2.0 is not a compatible version when running NUnit

I am trying to run the sample tests for NUnit, and I am getting an error. I have the supportedRuntime versions set to v1.0.3705 up to v2.0.50727. I have the requiredRuntime version set to v2.0.50727. Is this the wrong setting? The following is the error that shows: Metadata file 'c:\Program Files\NUnit 2.4.8\bin\nunit.framework...

How to test User Control with unit that relies on the Session object

I'm using ASP.NET to build an application and the latest version of NUNIT framework to test it. I'm constructing a User Control to build a custom menu. That control at some point checks whehter a specific object exists in the Session Collection or not to add some elements to the menu. The exact functionality it provides is this: if the ...

How do I unit test object serialization/deserialization in VB.NET 1.1?

I am looking for example code that provides a unit test to serialize and deserialize an object from a memory stream. I have found examples using C# 2.0, however my current project uses VB.NET 1.1 (don't ask me why...), so the solution can not use generics. I am also using the NUnit framework for the unit tests. Thanks! ...

How do I integration testing to my code written using the ASP.NET Provider Model?

I'm fairly new to unit testing. I have a site built in the 3-tier architecture, UI -> BLL -> DAL. And I used the asp.net Provider Model, so by making changes to web.config I can switch to DAL dll to target different data sources, to be complete the DAL is written with Entity Framework. Now, my question is how do I unit test my BLL? I...

Developers are dissatisfied with TDD. Is TDD really the problem, or is it a lack of skill of novice practicitioners?

(This is a not a question to survey the merits of TDD. There are other places for such discussions. Thanks in advance.) I've been experiencing too many developers who are novice at the technique, who are also reporting dissatisfaction with, test driven development and NUnit. I hear negative comments like: "I don't like NUnit. I t...

What's a good way to write Unit tests for code with protected objects C# (using NMock, and NUnit framework)

When writeing unit tests for a single class that contains other objects what's the best way to use mock objects to avoid tests dependant on other classes. Example 1: public class MyClass { protected MyObject _obj; public MyClass() { _obj = new MyObject(); } public object DoSomething() { //some work ...

DataRollBack with XtUnit in Nunit

Today I ran XtUnit at a part of my unit testing framework to to rollback database changes created while running a test case. This is a skeleton of how I have used it. The Test case ran successfully but the database state changed as a result. using NUnit.Framework; using TeamAgile.ApplicationBlocks.Interception; using TeamAgile.Applica...

How can I get started using Nunit in my Visual Studio project?

I want to start using Nunit (finally), I am using Visual Studio 2008. Is it as simple as importing Nunit into my test project? I remember seeing a GUI for NUnit, does that do the exact same thing that a separate test project would do, except show you the pass/fail visually? ...