nunit-2.5

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 /...

Whats the shortest way to assert that an attribute is applied to method in c#?

Whats the shortest way to assert that an attribute is applied to method in c#? I'm using nunit-2.5 :) ...

What is each tab in the NUnit Gui Runner supposed to be for?

There are six tabs in the NUnit Test runner: Errors and Failures Tests Not Run Console.Out Console.Error Trace Log I know what Errors and Failures are for but the purpose of the remaining tabs is confusing. Both Console.Out and Trace appear to serve a similar purpose. As a comment has pointed out, I have written a similar question...

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 possible to detect that one of the tests failed and perform some sort of cleanup? We do...

How to do exception handling with nunit and moq?

Hi I am trying to use nunits new way of exception handling but I am finding it hard to find information on it and how to also use it with moq. I have right now moq that throws a exception on a mocked method but I don't know how to use nunit to catch it and look at it. ...

Given -When-Then example with NUnit

Can anybody point me to some resources for Give-When-Then style of testing with NUnit? ...

Convert string to C# code

Hi, in the current NUnit version, I can parameterized TestFixture and instantiated it multiple times. E.g.: [TestFixture("var1")] [TestFixture("var2")] [TestFixture("var3")] public class MyTestFixture { private string var; public MyTestFixture(string var) { this.var = var; } ... ...

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 version 2.5.2 which introduced Assert.Throws( Type expectedExceptionType, TestDelegate code...

How do I get the current test/test method in Setup & TearDown?

In both my NUnit SetUp and TearDown methods, I need to retrieve the MethodInfo of the test that is about to be run or has been run. Is this possible? I'm using NUnit 2.5. Motivation: I would like to be able to retrieve, via Reflection, attributes attached to the test method. ...

Unit Test Organization

I'm using Nunit for unit testing, and added another project called "Unit Testing" to my current solution. I referenced Nunit, and changed the Namespace to the same namespace used in the main project. I can't seem to figure out how to get access to all the classes, files, etc in the main project. Is there something I have to do to link ...

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 an "empty" report XML file: <PartCoverReport date="2010-03-30T16:09:05.1009099+01:00" /...

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 framework, Int32 waitTime, Boolean enableDebug) at NUnit.Util.ProcessRunner.Load(TestPa...

Combining RequiresSTA and Timeout attributes on a test fails

I have a test that opens and closes a WPF Window and thus requires the STA threading apartment. To safeguard the test against the window staying open (and thus hang the test indefinitely) I wanted to use the Timeout attribute. The problem is that applying the Timeout attribute causes the test to fail on timeout regardless of whether th...

Can't get NUnit to work in Visual Web Develper 2010 express.

First off I was wondering whether it's possible to implement a functionality with Nunit where each time a project is created in Visual Web Developer 2010 I get a dialog asking whether I want to create a unit test project for current application like I saw it happen in the older versions of Visual Web Developer. I've tried just about eve...

Deploying an application that was unit tested with NUnit

I'm hopefully going to be deploying an application soon, and I find it strange that I would have to include nunit.framework.dll. After all, the user is not going to need to run unit tests! So the only thing I can think of is that there is some way of configuring my solution for Debug and Release, such that Debug references NUnit, while...

References/guides for nunit unit testing

Can anyone sugggest good references/guides for getting started with nunit and visual studio 2008. (Apart from the Nunit documentation itself!). I specifically want to set up a test project in vs 2008. ...

Test if property throws exception with nunit

Hi, it seems there are no delegates to properties. Is there a convenient way to do the following? Assert.Throws<InvalidOperationException>( delegate { // Current is a property as we all know nullNodeList.GetEnumerator().Current; }); ...

How to set up an NUnit project - Project Base and Application Base

Please forgive a very n00b question, but when using the GUI runner, Project->Edit... What directories should Project Base and Application Base point to? (Using the latest NUnit 2.5.7 and a VC# 2008 Express solution.) ...

simple question how to display exception message

I have a question that may seem stupid and simple, but I hardly have any idea how to proceed with it. My question is: How can I modify the exception message and customize it such that I still have my unit testing passing? Actually I want to customize the exception message to "Student "Johny" had related files!" and as modified the API...

NUnit 2.5.7 Breakpoint still not hit (VS2010) even after attaching to the Agent

Hello All, I am having a problem hitting the break point in debugging under VS2010 under NUnit recent recommended release 2.5.7 I have tried various ways as recommended by responses on Stack Overflow: 1) Attach to NUnit-agent.exe 2) Run time is correctly selected to 4.0 3) Attaching to Nunit.exe which does not even debug symbols When a...