nunit

Failing NHibernate test causes ReSharper test runner to hang for 30+ seconds

I have some NUnit integration tests to test my FluentNHibernate mappings using a SQLite in-memory database. I am using the ReSharper test runner (v5.0.1659.36) in Visual Studio 2008. When one of the NHibernate tests fails, the ReSharper test runner and Visual Studio freezes for 30+ seconds. (It will show that it failed but not show the...

Can I cause the NUnit GUI to break into the Visual Studio debugger on a breakpoint/failed test?

When using the NUnit GUI to run unit tests, is there a way to either: Set breakpoints inside the tests, or break into the Visual Studio Just-in-Time debugger upon failure of a test? ...

CollectionAssert.AreEquivalent with Custom IEqualityComparer

I have two lists, I want to check whether the two lists are the same ( order not important), and whether it's the same depends on the IEqualityComparer instance I implement. The ideal case is that I can use CollectionAssert.AreEquivalent with Custom IEqualityComparer. However it seems that CollectionAssert.AreEquivalent doesn't take in ...

How to use: PartCover .NET 4 with NUnit 2.5.6

Say I have Test assembly (NUnit compliant) App.Test.dll and a library to be tested App.dll. How do I get the code coverage analysis using PartCover and NUint? ...

NUnit Repeat attribute

Is it possible to use Repeat attribute in NUnit but failure of one repetition not to cause failure of remaining ones? So, if 3rd repetition is failed, i would like that NUnit still executes 4th, 5th, a so on... ...

ASP.net/C#: How compile classes in App_Code so that can be run from command line for unit testing?

I have several class files in App_Code in an ASP.net website running in Microsoft Visual Studio 2005 Professional. In liu of using a full unit test suite I just want to somehow compile those project-wide classses into an .EXE so that I can nightly run unit tests on them. I do know how to create a separate C# library project consisting ...

NUnit 2.5.6 + PartCover 2.0/4.0 = My Classes Not Shown

Summary: I can run unit tests and code-coverage, but the report only includes NUnit classes, not my application classes. I have successfully used PartCover in the past. Not so this time. I tried the latest PartCover (4.0), downgraded to the next latest (2.0), both with NUnit 2.5.6. I created a simple .NET 4.0 class library (also tried ...

Getting started with automated integration/unit testing in an existing code base

Background: We have been handed over a very large codebase (1.4 million lines) that is primarily in C#. The application consists primarily of asp.net 2.0 style asmx web services accessing data in a SQL server 2008 database and also in various XML files. There are no existing automated tests in place. We have an automated nightly build in...

How to unit test this ?

I've been playing around with .NET SpeechSynthesizer lately. and I've got a method that takes in a string and creates a .wav file out of that string. but how do I unit test this method ? seems to me like this situation is one in which unit testing cannot help you. am I right ? ...

The right way to catch assertion failure in NUnit

Hello. I'm writing an integration tests for my database, and I've got one question. At the beginning of a test method I'm adding some objects to database and at the end of the method I should remove it. So I've got a code like: var group = new ContactGroup { Name = UserLogin + "_test_group" }; group.ID = _provider.AddGroup(UserLogin, g...

NUnit Assert.AreEqual(object a, object b) false negative?

I can't understand why NUnit Assert.AreEqual is failing. var dataService = new DataService(db); dataService.Set("Tests", "circle1", circle); var circleData = dataService.Get("Tests", "circle1"); Assert.IsNotNull(circleData); var circleCopy = circleData.Get(); Assert.AreEqual(circle, circleCopy); Using NHibernate (storing serialized da...

Displaying NUnit console output in CruiseControl.NET

I want to get the console output along with the regular test results in the CruiseControl.NET build log. I was able to get this before when running NUnit from MSBuild, but now only the results of the tests are showing up when using the nUnit task directly. Is there a way to configure the nUnit task so all test output is written to the bu...

Unit testing NHibernate application with SQLite: it writes to the database but cannot read back

I have an application using NHibernate that is already deployed and working properly, and I'm re-factoring the unit tests to use SQLite for improved performance, and to keep unit test data out of the "real" database. I have a simple test that creates an Calendar entity, saves it, then tries to read it back and verifies that it's the sam...

Selenium 2 + firefox getting System.NotSupportedException

Hi, I am trying out WebDriverBacked selenium. I used the below code. But, it gives me "System.NotSupportedException : command" exception. IWebDriver driver= new FirefoxDriver(); Selenium.WebDriverBackedSelenium selenium= new WebDriverBackedSelenium(driver,myUrl); selenium.Type(locator,value); Here the command gets replaced by any sele...

Mocking Prism Event Aggregator using Moq for Unit Testing

Hi all, I need some advice on how to use Moq in a unit test to make sure that my class under test is behaving how I want. That is the class under test publishes an Event Aggregator (from Prism) event and I need some way of asserting that this event has been raised in my test. I don't have a lot of resource at work and am finding it dif...

Test events with nunit

Hi everybody, im just starting with TDD and could solve most of the problems i've faced on my own. But now im lost: How can I check if events are fired? I was looking for something like Assert.Raise or Assert.Fire but theres nothing. Google was not very useful, most of the hits were suggestions like foo.myEvent += new EventHandler(bar);...

Tests dependent on commonly used functionality with NUnit

Hi, I have some initialization code to use my API. The initialization may fail and I´d like to test it in an NUnit test. After the initialization the API may be used. I´m testing the API too, but all my test methods will use the same, common, initialization code. What I would ideally like is if this behavior: The Initialization test...

Stop generation of TestResult.xml with NUnit GUI test runner

Is it possible to stop the generation of TestResult.xml when using the NUnit GUI test runner, or to change the location that it is saved to? At the moment, it is always saving to the same directory as the nunit project file, and I can't seem to alter the behaviour. (Probably brain-freeze on my part.) I am using the latest release of NU...

NUnit expected exceptions

Hi I've got a set of test cases some of which are expected to throw exceptions. Because of this I have have set the attributes for these tests to expect exceptions like so: [ExpectedException("System.NullReferenceException")] When I run my tests locally all is good. However when I move my tests over to the CI server running TeamCity a...

Run a silverlight unit test inside of nunit-console.exe

What is the best way to do this? I want to get this working with nCover. ...