nunit

WatiN - How to handle auto complete popup?

We're having an intermittent problem that occurs when running certain integration tests on our continuious integration server.. For some reason, every now and then, we get an autocomplete popup that causes a timeout and ultimately a build failure. Is there an eloquent way to detect the popup and click through it? Thanks! ...

unit test service layer - NUnit, NHibernate

Hi, I would like to unit test a DEPENDENT service layer which allows me to perform CRUD operation without mocking using NUnit. I know this is probably bad practice but I want to give it a try anyway - even if the tests have to run over night. My data is persisted using NHibernate and I have implemented a little library that 'bootstraps'...

NUnit [Test] is not a valid attribute

I've included the necessary assemblies into a Windows Class project in VS2008. When I start to try to write a test I get a red squiggle line and the message [Test] is not a valid attribute. I've used NUnit before... maybe an earlier version. What am I doing wrong? I'm on version 2.5.2. using System; using System.Collections.Generic; usi...

NUnit GUI Runner and Apartment State

how do you set the apartment state in the NUnit GUI runner? I'm trying to run a single NUnit test with WatiN and I'm getting the message. MyNamespace.LoginTests.CanLogin: System.Threading.ThreadStateException : The CurrentThread needs to have it's ApartmentState set to ApartmentState.STA to be able to automate Internet Explorer. ...

Selenium/NUnit run one test on multiple IP addresses.

I have a test suite DLL written in C# that uses Selenium.This is then loaded into NUnit and tests can be performed on our embedded web server boards. Does anyone know how to run a NUnit Selenium test on multiple IPs in multiple browsers? I have tried creating multiple DefaultSelenium classes but they point to the same Internet Explorer...

How to integrate NUnit tests into a TFS 2010 build

What is the best way to integrate nunit tests into TFS 2010? Is it via generic tests or is there a better approach to running them? Ideally I'd like to have the granularity of one generic test per test assembly and have a way to surface the results in the TFS build report. ...

NUnit, CollectionAssert.AreEquivalent(...,...), C# Question

I'm new to NUnit and looking for an explination as to why this test fails? I get the following exception when running the test. NUnit.Framework.AssertionException: Expected: equivalent to < <....ExampleClass>, <....ExampleClass> > But was: < <....ExampleClass>, <....ExampleClass> > using NUnit.Framework; using System.Collec...

Nunit Relative Path failing

I'm having an issue with Nunit where I cannot find an image file when I run my tests and each time it looks for images it looks in the Nunit folder instead of looking inside the folder where the binary resides. Below is a detailed description of what's happening. I'm building a binary that is under test which contains the definition f...

Null reference to DataContext when testing an ASP.NET MVC app with NUnit

I have an ASP.NET MVC application with a separate project added for tests. I know the plusses and minuses of using the connection to the database when running unit tests, and I still want to use it. Yet, every time when I run the tests with the NUnit tool, they all fail due to my Data Context being null. I heard something about having a ...

How to Unit Test HtmlHelper similar to "using(Html.BeginForm()){ }"

Can somebody please suggest how I could write a Unit Test with Moq for following HtmlHelper method? public static HtmlTagBase GenerateTag<T>(this HtmlHelper htmlHelper , object elementData , object attributes) where T : HtmlTagBase { return (T)Activator.Creat...

How to Unit Test HtmlHelper with Moq?

Could somebody show me how you would go about creating a mock HTML Helper with Moq? This article has a link to an article claiming to describe this, but following the link only returns an ASP.NET Runtime Error [edit] I asked a more specific question related to the same subject here, but it hasn't gotten any responses. I figured it was ...

TeamCity stopped working once I added NUnit to the mix

I'm struggling a lot trying to get our build server going. I am currently running tests in a Windows XP virtual machine, and have installed TeamCity v5.0.3, build 10821. I am using NUnit v2.5.3. I finished the initial setup with TeamCity without any issues at all, provided that I use the sln2008 build runner that makes the entire proc...

Could model unit tests be truly independent and how [ASP.NET MVC]

I am new to the whole unit testing stuff, so please excuse my lack of experience. I've read a lot of materials saying that no test should depend on others to do, i.e unit tests be completely independent form each other. Can you really do that in reality? I am having the following example: I have a few entity classes depending on each oth...

TDD a controller with ASP.NET MVC 2, NUnit and Rhino Mocks

What would a simple unit test look like to confirm that a certain controller exists if I am using Rhino Mocks, NUnit and ASP.NET MVC 2? I'm trying to wrap my head around the concept of TDD, but I can't see to figure out how a simple test like "Controller XYZ Exists" would look. In addition, what would the unit test look like to test an...

NUnit does not capture output of std::cerr

I have an nunit Test in C#, that calls a C# wrapper of a function in a C++ DLL. The C++ code uses std::cerr to output various messages. These messages cannot be redirected using nunit-console /out /err or /xml switch. In nunit (the GUI version) the output does not appear anywhere. I would like to be able to see this output in nunit (GU...

C#: IComparable implementation private

Hello I'm new to C# so this might be a really dump question: I implemented IComparable in my class and want to test it with NUnit. But the CompareTo-Method is marked as private and thus not accessible from the test. What's the reason for this and how can I fix this? The IComparable: public class PersonHistoryItem : DateEntity,ICompa...

Is it possible to run NUnit 2.5.3 tests in Gallio?

When I try to run NUnit tests in Gallio I get this: Detected a probable test framework assembly version mismatch. Referenced test frameworks: 'nunit.framework, Version=2.5.3.9345, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77'. Supported test frameworks: 'nunit.framework, Version=2.5.0.0-2.5.2.65535', 'nunit.framework, Version...

nUnit Assert.That(method,Throws.Exception) not catching exceptions

Hi Everyone, Can someone tell me why this unit test that checks for exceptions fails? Obviously my real test is checking other code but I'm using Int32.Parse to show the issue. [Test] public void MyTest() { Assert.That(Int32.Parse("abc"), Throws.Exception.TypeOf<FormatException>()); } The test fails, giving this error. Obviousl...

VS 2003 NUNIT: How to write test for dynamic dataset result

I have a method call that generates following output depending on the resultset returned from database... The data is (pointsdate, points) 9/1/09 , 190 11/1/09 , 77 12/3/09 ,88 2/13/10 , 97 So how do I create NUNIT test for this? What kind of things I could check for? What could be all the possible combination of tests? ...

Configuring TeamCity + NUnit unit tests so files can be loaded properly

In a nutshell, I have a solution that builds fine in the IDE, and the unit tests all run fine with the NUnit GUI (via the NUnitit VS2008 plugin). However, when I execute my TeamCity build runner, all unit tests that require file access (e.g. for running tests against specific XML files), I just get System.IO.DirectoryNotFoundExceptions....