Questions tagged [nunit-2.5]

For issues relating creating and running unit tests using NUnit, version 2.5.

NUnit is an open source unit testing framework for Microsoft .NET written in C#. It serves the same purpose as JUnit does in the Java world, and is one of many in the xUnit family.

91 questions
42
votes
11 answers

NUnit - cleanup after test failure

We have some NUnit tests that access the database. When one of them fails it can leave database in inconsistent state - which is not an issue, since we rebuild database for every test run - but it can cause other tests to fail in the same run. Is it…
bh213
  • 6,002
  • 8
  • 40
  • 51
28
votes
7 answers

Why do my tests fail when run together, but pass individually?

When I write a test in Visual Studio, I check that it works by saving, building and then running the test it in Nunit (right click on the test then run). The test works yay... so I Move on... Now I have written another test and it works as I have…
Graeme Secondwave
  • 283
  • 1
  • 3
  • 6
27
votes
3 answers

Testing if a collection contains objects based on a particular property

I'm using NUnit 2.5.7. I want to test whether a collection of custom objects of a particular class contains certain objects, based on one of the class's properties. e.g. a contrived example... public class Person { public string Name { get;…
ngm
  • 6,897
  • 1
  • 49
  • 60
20
votes
2 answers

What happended to nunit extensions/rowtest?

In NUnit 2.4.7, nunit.framework.extensions.dll was included which made it possible to do RowTests. When downloading the newest version (2.5.8) I can't find it. What happened to it?
Allrameest
  • 3,979
  • 2
  • 30
  • 50
19
votes
2 answers

nunit not working in windows 7 at all

I am new to unit testing and this ism y first time trying NUnit. My environment is windows 7 professional 64 bit, visual studio 2010 and i am working on a windows application in C#. I just wrote a single test and i am trying to run the test using…
swordfish
  • 4,569
  • 5
  • 29
  • 57
15
votes
5 answers

Data-driven testing in NUnit?

In MSTest you can do something like: [TestMethod] [DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "testdata.csv", "testdata#csv", DataAccessMethod.Sequential)] public void TestSomething() { double column1 =…
Nobody
  • 4,541
  • 5
  • 30
  • 62
12
votes
2 answers

What is difference between EqualTo() and EquivalentTo() in NUnit?

When I have a Dictionary actual and then create a completely new Dictionary expected with the same values as actual. Calling Assert.That(actual, Is.EqualTo(expected)); makes the test pass. When using Assert.That(actual,…
Garth Marenghi
  • 1,857
  • 4
  • 18
  • 34
12
votes
2 answers

NUnit 2.5.8, lots of nunit-agent.exe

Each time I run a test in nunit I get another nunit-agent, which does not exit the test completes, or when the tests are reloaded in nunit or when I restart nunit. This ever increasing list of nunit-agent.exe's creates a increasing problem when I…
user206890
  • 531
  • 6
  • 17
10
votes
2 answers

NUnit fail with System.ArgumentException: The net-4.0 framework is not available

Exception: ProcessModel: Default DomainUsage: Single Execution Runtime: net-4.0 Unhandled Exception: System.ArgumentException: The net-4.0 framework is not available Parameter name: framework at NUnit.Util.TestAgency.GetAgent(RuntimeFramework…
Andreas Öhlund
  • 5,253
  • 17
  • 24
10
votes
3 answers

NUnit. Passing parameters into teardown method

I'm using NUnit. I have my test method defined likeso: [Test] [TestCase("Fred", "Bloggs")] [TestCase("Joe", "Smith")] public void MyUnitTest(string firstName, string lastName) { ... } After a TestCase has finished, it goes into the TearDown…
Christian Clarke
  • 781
  • 1
  • 7
  • 7
9
votes
4 answers

Test if property throws exception with nunit

it seems there are no delegates to properties. Is there a convenient way to do the following? Assert.Throws( delegate { // Current is a property as we all know …
atamanroman
  • 10,631
  • 6
  • 51
  • 77
8
votes
4 answers

ExceptionAsserts & debugging your C# project in VS

We've been using NUnit & VisualStudio to write C# .NET code for a while now. Testing Exceptions was done in the style of old syntax: [Test] [ExpectException(typeof(ExceptionType))] public void TestExceptionType() { } Now NUnit has released…
Timo Kosig
  • 845
  • 9
  • 23
7
votes
6 answers

Using PartCover 2.3 with .NET 4.0 runtime?

I've successfully got PartCover 2.3 working with VS 2008 on my 64-bit machine. I'm now trying to get it to work with VS 2010 and NUnit 2.5.3. I've got NUnit using the correct CLR version, but I can't get PartCover to produce any output. All I get is…
Roger Lipscombe
  • 81,986
  • 49
  • 214
  • 348
7
votes
1 answer

Can NUnit expect a timeout?

I would like to test a method that I am expecting to block in a specific situation. I tried a combination of the TimeoutAttribute and ExpectedExceptionAttribute: [Test] [Timeout(50), ExpectedException(typeof(ThreadAbortException))] public void…
CodeFox
  • 2,824
  • 1
  • 24
  • 40
7
votes
4 answers

Given -When-Then example with NUnit

Can anybody point me to some resources for Give-When-Then style of testing with NUnit?
epitka
  • 16,049
  • 19
  • 81
  • 130
1
2 3 4 5 6 7