nunit

Compare equality between two objects in NUnit

I'm trying to assert that one object is "equal" to another object. The objects are just instances of a class with a bunch of public properties. Is there an easy way to have NUnit assert equality based on the properties? This is my current solution but I think there may be something better: Assert.AreEqual(LeftObject.Property1, RightO...

How do I test database-related code with NUnit?

I want to write unit tests with NUnit that hit the database. I'd like to have the database in a consistent state for each test. I thought transactions would allow me to "undo" each test so I searched around and found several articles from 2004-05 on the topic: http://weblogs.asp.net/rosherove/archive/2004/07/12/180189.aspx http://weblo...

web service and nunit testing

I have created a console application that calls a method on a webservice. I have accessed the webservice and get the response back from the console application that I expect. When I create a separate test assembly and create some nunit tests which call the same method in the same way i get the following exception:- System.InvalidOperati...

Can you mock requests with NUnit in webforms?

Hi, Can you do mock page requests with NUnit with webforms? what about web service testing? ...

Starting ASP.NET Development Web Server (Cassini) as part of unit test setup?

I'm using WatiN, NUnit and ReSharper to run my ASP.NET unit tests inside Visual Studio. I'd like (if it's not already running) to start Cassini to run my tests against. Is this possible? How would I do it? ...

Is this safe? - NUnit base class opens and rollsback a TransactionScope

I was thinking it would be nice to create a base class for NUnit test fixtures that opens a TransactionScope during the SetUp phase, then rolls back the transaction during tear down. Something like this: public abstract class TestFixtureBase { private TransactionScope _transaction; [TestFixtureSetUp] public void TestFixtureSetup...

What is the best Nunit test runner out there?

Having recently gotten into test driven development I am using the Nunit test runner shipped as part of resharper. It has some downsides in terms of there is no shortcut to run tests and I have to go looking for the Nunit test runner to invoke it using the mouse. It has a nice GUI and shows the results as part of the IDE well. What do o...

With NUnit, what project type in Visual Studio do I need to use to create my test project?

When I am creating a test project in Visual Studio, do I just create a C# console project type, then import Nunit? Does the GUI then hook into this project somehow? There seems to be tons of nunit related .dll's, which ones do I need? ...

Minimum NUnit binaries for an OSS project

Open Source projects that ship with unit tests based on NUnit also usually ship the NUnit runners and accompanying binaries. For NUnit 2.4.8, distributing its bin directory verbatim with the actual project amounts to 46 files and a blank addins directory. What would be the minimum set of files needed if all one wanted was to distribute t...

Using NUnit-2.5 RequiresSTAAttribute with TeamCity 4

Using TeamCity, I'm trying to get a (TestAutomationFX) test that requires an STA thread to run . It works via a custom app.config that configures NUnit 2.4.x (8) (as referred to by Gishu, thanks, described at http://madcoderspeak.blogspot.com/2008/12/getting-nunit-to-go-all-sta.html) It works via: /// <summary> /// Via Peter Provost /...

Why would I want to use the debug mode of the .NET compiler?

I was curious what the differences are between the debug and release modes of the .NET compiler and came across these questions about debug vs release in .NET and reasons that release will behave differently than debug. Up to this point I really haven't paid much attention to these compiler modes. Now I will. My question is, assumin...

How to write Unit Tests for Web Applications and Controls

I am just learning about Unit Testing. I am using NUnit to build tests for a VB.NET project. The project I'm working on is part of a framework which will be used by people who build ASP.NET websites. It includes a base class (which inherits System.Web.HttpApplication) that users of my framework will inherit their application class fro...

How to test fluent-NHibernate's PersistenceSpecification.VerifyTheMappings with lists and relational objects?

How would you test this scenario? I've just started looking into NHibernate and having my first bash at TDD. So far I've really enjoyed it and have been using fluent-Nhibernate for my mapping of the classes. However I seem to be hitting a dead end when it comes to using the VerifyTheMappings method on PersistenceSpecification. Essenti...

best way to run multi-threaded nunit tests

I currently trying to find a solution, how to ensure that a test fails if an exception occurs in a thread which is spawn by the test method. I DON'T want to start a discussion about more than one thread in a unit test. => "unit test".Replace("unit","integration"); I already read a lot of threads in several forums, I know about CrossThr...

"Thorough", tutorial on setting up Jetbrain's TeamCity CI server

Does anyone know where I can find a good tutorial to walk me through how to setup TeamCity CI server? I am new to unit testing and the agile philosophy of development so I could use some help getting my feet wet. I'm working with Asp.NET code using NUnit for my unit tests and would prefer a windows environment for the TeamCity server. Pl...

Why does this unit test fail when testing DateTime equality?

Using NUnit 2.2 on .NET 3.5, the following test fails when using DateTime.Equals. Why? [TestFixture] public class AttributeValueModelTest { public class HasDate { public DateTime? DateValue { get { DateTime value; return DateTime.TryParse(ObjectValue.ToStrin...

Should I mix my UnitTests and my Integration tests in the same project?

I am using NUnit to test my c# code and have so far been keeping unittests (fast running ones) and integration tests (longer running) seperate and in separate project files. I use nunit for doing both the unittests and the integration tests. I just noticed the category attribute http://www.nunit.org/index.php?p=category&amp;r=2.2 that nu...

NUnit [TearDown] fails -- what process is accessing my files?

Hi All - Final Edit: I found a solution to the problem (at the bottom of the question). I've got an Nunit problem that's causing me grief. Edit: actually it looks more like a SQLite problem, but I'm not 100% certain yet. My TestFixture has a setup that generates a random filename that's used as a SQLite database in each of my tests. ...

How to make UnitTest fail automatically after some time?

I am using NUnit (2.4.6) and my build/test night are done with Team City 4. I have contacted team city and they already told me that they cannot handle this. So, here I am. What I want is to set up my test to do their testing as usual but in the case they hang up... for an unknown reason (this might happen...)... I do not want them to c...

How do you deal with failing Unit Tests?

I have a number of projects in a solution file that have unit tests written for them and I am wanting to set them up to be run by our continuous integration server. However, because many of the tests have been written poorly and have not been run regularly there are many that are failing. I don't have the time at the moment to fix all o...