nunit

Having trouble getting NUnit's Assert.Throws to work properly

I could have sworn that I've used NUnit's Assert.Throws to determine whether or not a particular exception gets thrown from a method, but my memory has failed me before. I read this post here on SO, but it didn't answer my question, as I know the correct syntax, and I don't want to do anything with the exception that gets returned (I do...

The problem with NUnit and app.config

When i run a simple test on connection to DB check i receive an error in NUnit: [Test] public void TestConn() { string connectionString = ConfigurationManager.ConnectionStrings["FertigungRead"].ConnectionString; SqlConnection connection = new SqlConnection(connectionString); connection.Open(); Assert.AreEqual(Connectio...

NUnit's TestCaseAttribute equivalent in Visual Studio 2008 unit test framework

Is there an NUnit's TestCaseAttribute equivalent in Visual Studio 2008 unit test framework? You know, something like this: [TestCase(1, 1, 1)] [TestCase(2, 2, 2)] [TestCase(3, 3, 3)] public void Test1(int a, int b, int c) { // do stuff depending on the TestCase } Thanks in advance ...

CruiseControl.NET only shows one NUnit Assembly on NUnit Details page

I am using NUnit with CruiseControl.NET. I have many test projects and assemblies. When I run my tests, on the NUnit Details page, it only shows one assembly, but with all of the tests from all assemblies. In the log, it lists them as separate in the XML. How can I fix this? Thanks. ...

Is there a functional difference between Assert.That and traditional syntax?

In NUnit, I can write either Assert.That(5, Is.EqualTo(5)); or Assert.AreEqual(5, 5); Is there any functional difference between these two forms or is the choice between the two just down to personal preference and perception of readability? ...

How do I make NUnit respect my bindingRedirect in my testassembly.dll.config?

I am using the 1.0 RTM of Fluent Nhibernate, with a 3.0 build of NHibernate. In order to do this, I need to add the following to my .config file: <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="NHibernate" culture="neutral" publicKeyToken="aa95f207798dfdb4"/> <...

Are there real differences between NUnit and Microsoft's Unit Testing Framework (VS 2008)?

With the framework that Visual Studio 2008 has, am I missing anything great by NOT using an external tool like NUnit? From what I can tell it seems like using NUnit would be more of a hassle with manually creating test classes and methods versus the right clicking native to the IDE. That being said, am I missing features that NUnit pro...

Is there CI server software that can do all of this?

I'm trying to put together a Continuous Integration server that will do the following: Work with subversion Use NUnit tests (fail build on failed tests) Use partcover (fail build on < X% coverage) Run code against FxCop (fail build on FxCop warnings, given settings) Run code against StyleCop (fail build on StyleCop warnings, given sett...

a problem with NUnit environment

I have a problem: if i run this test in NUnit ,it works Board board = new Board("ab", 12, 120,BoardType.OEM, BoardSide.DoubleSide); Assert.NotNull(board); but when i want to add another Assert statement as Assert.AreEqual(board.SNR, "ab"); it runs, and the NUnit window is immediately closed. Why does it close automaticaly? ...

How do I output coloured text from by unit tests in the Unit Test Session window in Visual Studio?

How do I output coloured text from by unit tests in the Unit Test Session window in Visual Studio. I am using Resharper VS addin which I think produces the Unit Test Window. I am using this with nunit and wish to use c# Console.Write to generate coloured text to this window. ...

Why does NUnit ignore datapoints when using generics in a theory

I'm trying to make use of the TheoryAttribute, introduced in NUnit 2.5. Everything works fine as long as the arguments are of a defined type: [Datapoint] public double[,] Array2X2 = new double[,] { { 1, 0 }, { 0, 1 } }; [Theory] public void TestForArbitraryArray(double[,] array) { // ... } It does not work, when I use generics: [D...

How to unit test configs

We're working with some very large config files which contain lots of Unity and WCF configuration. When we open some of these configs in the SVC config editor or even try to open a web application using these configs, we recieve errors showing any typos or errors. E.g. a WCF binding is invalid or does not exist etc, or a configuration s...

how to test asynchronous methods using nunit

Hi, how to test asynchronous methods using nunit. please show a working sample. Thanks in advance ...

nunit-console.exe hangs after finishing test run

Hi We got a problem with NUnit 2.5.3: nunit-console.exe does not return after finishing all tests. The process hangs forever. Example: All tests succeed, but it keeps doing something. Output: Runtime Environment - OS Version: Microsoft Windows NT 5.1.2600 Service Pack 3 CLR Version: 2.0.50727.3603 ( Net 2.0.50727.3603 ) ProcessModel...

How to run unit tests in STAThread mode?

I would like to test an app that uses the Clipboard (WindowsForms) and I need the Clipboard in my Unittests also. In order to use it, it should run in STA mode, but since the NUnit Testfixture does not have a main method, I don't know where/how to annotate it... Thanks! ...

Is there a Visual Studio Test Project template for NUnit?

Is there an official Visual Studio test project template for NUnit? If not, what might one look like? ...

VS 2008 -- Using Relative paths in Build Properties

Hey all, Long story short, I have a test project file (C# project) that contains the NUnit assemblies. When I hit F5, the build properties tell the project to launch NUnit and run the appropriate tests. However, I work with a team and this project (including the NUnit binaries) are in subversion. Which means that when my partner pulls ...

How to write Performance Test for .Net application?

How to write Performance Test for .Net application? Does nUnit or any other Testing framework provides framework for this? Edit: I have to measure performance of WCF Service. ...

How to invoke WPF Dispatcher in Nunit?

I want to test an application which renders a text block with a data field value. I would like to get the actual width and actual height, once the rendering completes. Everything works fine. The problem came first, when I tried to test the application. I'm unable to invoke the dispatcher from the test project. Following is the code. ...

Unit Test For NpgsqlCommand With Rhino Mocks

My unit test keeps getting the following error: "System.InvalidOperationException: The Connection is not open." The Test [TestFixture] public class Test { [Test] public void Test1() { NpgsqlConnection connection = MockRepository.GenerateStub<NpgsqlConnection>(); // Tried to fake the open connection c...