nunit

Testing for a deadlock with nUnit

Hello - I'm new to unit testing and nUnit (2.48). I'd like to write a test method where the failure case is that it deadlocks. Is this possible? Obviously nUnit doesn't know by default how long the method should take to execute, so would I have to write code to do the work on a separate thread and then abort it and throw and exception if...

Using nuint with asp.net web forms

I have an existing asp.net webforms application with all its business logic and DAL in the app_code folder. What is the best way to structure tests with nunit ? Add a separate test project to the solution or do I have to put the tests in the app_Code folder ? ...

Configuring Cruise Control with NUnit and SVN

I am trying to configure Cruise Control with Nunit for reporting purpose. But I am unable to do this task. Any one can please help me how to configure the ccnet.config file for its configuration and also some easy and step by step tutorial for its explanation. ...

error MSB1009: Project file does not exist on running fromCruiseControl

Following is my ccnet.config file, When running this file from ccnet webpage, it is giving me error MSB1009: Project file does not exist. ANy idea where I am doing wrong <project> <name>ITR Test</name> <webURL>http://localhost/ccnet/&lt;/webURL&gt; <triggers> <intervalTrigger name="continuo...

Getting WatiN.Core.Exceptions.TimeoutException while running from CruieControl

I am getting WatiN.Core.Exceptions.TimeoutException : Timeout while Internet Explorer busy error while executing my tests via CruiseControl.Net. Any one have idea how to resolve this. ...

Why does this NUnit+Moq test fail?

I hope you know, because I don't see it. Bonus points for whoever figures out how one can achieve what this test is trying to achieve. using NUnit.Framework; using Moq; [TestFixture] public class MoqHuh { public class A {} public class B : A {} public interface IHelper { void DoIt(A a); } [Test] pu...

Why is CSharpOptParse UsageBuilder failing due to an XPathException only when used in an NUnit test?

What is the root cause of this issue? CSharpOptParse, XslTransform.Transform(...), or NUnit? What other equivalent library could I use instead, if this problem is unfixable, that is being actively supported? I'm using version 1.0.1 of CSharpOptParse which was last modified in Feb 2005. I've have the following class (simplified for this...

Process Kill during execution of Nunit tests

I have a test project that takes alot of time to test cases. I have configured cruisecontrol.net with Nunit, msbuild. Now if I run my project during the execution of Nunit it kills the process and fail the build. Also if you force a build then results are not updated it shows the last build results and also giving Textfixturesetup failed...

Unit test HttpContext.Current.Cache or other server-side methods in C#?

When creating a unit test for a class that uses the HttpContext.Current.Cache class, I get an error when using NUnit. The functionality is basic - check if an item is in the cache, and if not, create it and put it in: if (HttpContext.Current.Cache["Some_Key"] == null) { myObject = new Object(); HttpContext.Current.Cache.Insert(...

How to test for sometimes fails?

I'm trying to write a unit test for a module that will give me a random list of numbers given certain criteria. The particular test I'm writing is a reshuffle of the original sequence. I'm testing that The sequences are the same length The sequences have the same values The sequences are not in the same order The problem with this i...

nunit is not an available test framework in vs2008

I have been running Visual Studio 2008 Team Edition for some time now and need to start using nunit. I loaded nunit 2.4.8 but nunit is not showing as a selection for a testing framework. This is the selection you see when starting a new project and it asks if you want to setup a testing project and which framework you wish to use (only...

Is there a way to Execute NUnit Tests in a Specific Order?

When I am testing my DAL I need to create some database entities before others because of dependencies, is there a way via method attributes or something I can make NUnit execute my tests in the order I specify ? ...

Is it bad form to count on the order of your NUnit unit tests.

I have been creating Unit tests like crazy and find that I'm often having to set up something in one test that I just tore down in a previous test. Is it ever reasonable to create something (e.g. a database record) in one test (e.g. an Insertion test) and then use it for a later test (e.g. a Deletion test)? Or should each and every tes...

NUnit crashes when cc3270mt.dll is loaded

I have a problem where NUnit Assert.IsTrue crashes with an "access denied" (0xc0000005) access violation. Since managed applications are not supposed to cause such errors, I started looking at any unmanaged code loaded by the NUnit tests. And sure enough, after a process of elimination the simplest way to reproduce the problem turned out...

Unit testing XML Generation.

What unit testing strategies do people recommend for testing xml is being generated correctly. The my current tests seem abit primitive, something along the lines of: [Test] public void pseudo_test() { XmlDocument myDOC = new XmlDocument(); mydoc = _task.MyMethodToMakeXMLDoc(); Assert.AreEqual(myDoc.OuterXML(),"big string of ...

Driving NDepend with NUnit

Is it possible to use NUnit to run CQL queries using NDepend? It would be nice to be able to just include the NDepend dlls in a UnitTests library and write tests like: [Test] public void DomainAssemblyHasNoDatabaseDependencies ... or something similar. This would make it very easy to integrate with Team City, and automatically fail ...

NUnit reference binaries in other directory

Hi, I'm running the NUnit tests and everything is fine as long as the required dlls are in the same directory as tests. Otherwise I get the error "Could not load file or assembly". NUnit console doesn't seem to have any switch to include default path, nor it uses system PATH variable while looking for assemblies. The question is how to...

Why am I getting a FileNotFound exception when referencing another project from the same solution?

I am learning how to use NUnit. I have my main project in it's solution, and created a separate project in that same solution which will hold my unit tests, with it's own namespace. From that project I add a reference to the main project and add a using MainProjectNamespace; to the top of it. When I go to NUnit, any tests I have t...

SetUp in derived classes with NUnit?

If I have the following code: [TestFixture] public class MyBaseTest { protected ISessionManager _sessionManager; [SetUp] public void SetUp() { /* some code that initializes _sessionManager */ } } [TestFixture] public class MyDerivedTest : MyBaseTest { IBlogRepository _repository; [SetUp] public void SetUp() { ...

Cassini/WebServer.WebDev, NUnit and AppDomainUnloadedException

I am using Cassini/WebServer.WebDev to run some automated tests of a WebService using NUnit. I am not doing anything fancy, just public class WebService{ Microsoft.VisualStudio.WebHost.Server _server; public void Start(){ _server = new Microsoft.VisualStudio.WebHost.Server(_port, "/", _physicalPath); } public void Dispose...