Questions tagged [nunit-2.6]

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

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.

21 questions
9
votes
1 answer

Does NUnit dispose of objects that implement IDisposable?

Does NUnit dispose of objects that implement IDisposable on cleanup? I realize there are various ways I can get an object disposed of in a method, but, for example, if the method fails prior to the object being disposed - will NUnit take care of…
user2338408
  • 182
  • 1
  • 11
8
votes
1 answer

NUnit 2.6.3 - Tests not executing with message Test adapter sent back a result for an unknown test case

I am playing with NUnit 2.6.3 and I did this tests: using NUnit.Framework; using System; namespace NUnit26Tests { [TestFixture] public class RandomTests { [Test] public void RandomTest([Random(1, 100, 5)] int value) …
ferpega
  • 3,182
  • 7
  • 45
  • 65
5
votes
2 answers

Assert "at least one item in the result collection matches predicate"

I want to assert that at least one item of a collection matches a given predicate with NUnit. I already asserted that the number of items is greater than 0, so it suffices to mimic the behavior of LINQ's Any() method. I'm looking for something…
D.R.
  • 20,268
  • 21
  • 102
  • 205
4
votes
1 answer

Use Values- and Range-Attribute in NUnit TestFixture constructor

I have multiple test methods which should test all possible combinations of multiple parameters. I can use the NUnit ValueAttribute or RangeAttribute on methods like this: [TestFixture] public class MyExampleTests { [Test] public void…
Xarbrough
  • 1,393
  • 13
  • 23
3
votes
0 answers

Must I rebuild Nunit 2.6.2 to use it with .net 4.0?

When I try to run some tests with: nunit-console.exe /framework:net-4.0 I am rewarded with: Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'nunit-console-runner, Version=2.6.2.12296, …
bmargulies
  • 97,814
  • 39
  • 186
  • 310
2
votes
1 answer

How to run NUnit 2 tests in visual studio 2022

I am trying to execute NUnit tests on a legacy project in Visual Studio 2022 professional. Migrating from NUnit 2 to NUnit 3 is not yet an option, and part of the team works with Visual Studio 2019. The problem I am facing is that the tests are not…
jf_
  • 3,099
  • 2
  • 13
  • 31
2
votes
1 answer

Recover database between unit tests: Database is still in use

We got some unit tests that are working with SQL Server databases. To make at least every test fixture unique and independent to other test fixtures I try to recover the database before every test fixture starts. Every test opens and closes the…
Martin Braun
  • 10,906
  • 9
  • 64
  • 105
2
votes
0 answers

Why is this NUnit test failing?

This is an "extension" of the question here I am now running two instances of Visual Studio / the solution. I start one, and then in the other I access the context menu for this test: public enum HttpMethods { GET = 0, PUT, POST, …
B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862
1
vote
1 answer

NUnit async tests fail after merge

NUnit 2.6.4. I have a VS/C# project that introduces async methods. It has many tests like this that pass: [Test] public async void NullProcThrows_Async() { var keyList = new KeyList(); …
n8wrl
  • 19,439
  • 4
  • 63
  • 103
1
vote
1 answer

How to run code-coverage from the command line with NUnit 2.6

I use Visual Studio 2015 with NUnit 2.6, and I'm able to run my unit tests from the UI and see the code coverage in Visual Studio. -- My solution has about 10 projects in it. I'd like to be able to script this process and invoke it from the command…
BrainSlugs83
  • 6,214
  • 7
  • 50
  • 56
1
vote
0 answers

NUnit test not working with Entity Framework ToListAsync()

The source IQueryable doesn't implement IDbAsyncEnumerable. Only sources that implement IDbAsyncEnumerable can be used for Entity Framework asynchronous operations. For more details see http://go.microsoft.com/fwlink/?LinkId=287068. I am new to…
GMCS Pune
  • 83
  • 1
  • 14
0
votes
1 answer

Why is NUnit ignoring tests with Combinatorial/Values attributes?

I tried to use Combinatorial/Values attributes in NUnit. While it works locally, the test decorated with those attributes are skipped in TeamCity build running NUnit 2.6.2—the build report indicates that the test was ignored, without giving any…
Arseni Mourzenko
  • 50,338
  • 35
  • 112
  • 199
0
votes
1 answer

How to re-run a fail Nunit Test 2.6.2

I am trying to Re-run failed Nunit tests, mainly because of flackiness with selenium. [TearDown] public virtual void TearDown() { var testName = TestContext.CurrentContext.Test.FullName.Replace("Server.Tests.", string.Empty); …
Kuzon
  • 782
  • 5
  • 20
  • 49
0
votes
1 answer

nunit 3 tests on command line as nunit 2.6.4

I have the following Nunit 3 command running in a console window. sh "#{NUNIT}" \ ' Build\bin\Testing\Functional\Functional.dll --test=Functional.Features.Customer.Account.NotificationDetailsFeature.Register' I need to be able to do…
dstewart101
  • 1,084
  • 1
  • 16
  • 38
0
votes
1 answer

Not able to add message while skipping a test case with Assert.Ignore

I am trying to add a message when I try to skip a test case my condition statement. I am able to skip without adding a message. But I would like to add a message for the reason to skip it. But Nunit never displays the message. if (...) { …
user1413
  • 527
  • 4
  • 21
1
2