nunit

Another PartCover Empty Report Question

I've tried the steps listed here, but I still can't get partcover to generate any output other than: <?xml version="1.0" encoding="utf-8"?> <PartCoverReport ver="2.2.0.36423" /> Here is what I've done: Installed 2.2 instead of 2.3 Ran corflags /Force /32bit+ PartCover.exe Ran corflags /Force /32bit+ PartCover.browser.exe Here is m...

NUnit running the wrong test assembly

I'm running NUnit from VS2k8 by setting it as the start action for the test project. That worked fine when I only had a single solution with a single test project. I'm trying to run tests in a second solution now, but when NUnit launches it's loading Solution1Name.Test instead of Solution2Name.test ...

How to use PEX with NUnit tests in VS 2010?

Hi, I am aware that the current release of PEX allows use with the NUnit framework. The thing is I can't configure it to use the NUnit framework. In the Options -> PEX: What Exactly do i have to put in the "TestFramework" and "TestFrameworkDirectory". I Have tried many combinations but failed to achieve any success. ...

Using Lambdas as Constraints in NUnit 2.5?

According to Charlie Poole's NUnit blog, it is possible to use Lambda expressions as constraints in NUnit 2.5. I just can't seem to be able to get it to work? I am using NUnit 2.5.3.9345. Using the example lambda from the blog post: [TestFixture] public class Class1 { [Test] public void someTest() { int[] array = {1...

Best practices for multiple asserts on same result in C#

What do you think is cleanest way of doing multiple asserts on a result? In the past I've put them all the same test but this is starting to feel a little dirty, I've just been playing with another idea using setup. [TestFixture] public class GridControllerTests { protected readonly string RequestedViewId = "A1"; protected Grid...

using Moq and NUnit , what is write approach / better syntax ?

I am trying to test this behavior -- BLOGTableAdapter.GetBlogsByTitle(string title) is called and for once only -- and is called with string having length greater than 1, -- and it returns BLOGDataTable Object [Test] public void GetBlogsByBlogTitleTest4() { var mockAdapter = new Mock<BLOGTableAdapter>(); ...

NUnit: configuration settings cannot be found

I've written an NUnit test project against an ASP.Net project. The code being tested cannot find the configuration values (in Web.config) when invoked from my test project. What is the right way to provide these configuration settings so my tests will run? ...

How to mock an object, declared / initialized inside a method under test ?

Consider this programs public class ItemManager { private ItemFetcher itemFetcher; public ItemManager(ItemFetcher _itemFetcher) { itemFetcher = _itemFetcher; } public List<Item> GetItemsFomTable() { List<Item> itemsList = new List<Item>(); Item item; DataTable resultDataTable = it...

Why Test crashes using NUnit / TestDriven.Net2.0 ?

I have a Set of TestFixtures running fine. I added a new Test into the fixture, but for some reason, I am not able to run it. Other tests in other classes and even in the same class run fine. Both NUnit GUI / TestDriven crash If I run from NUnit GUI I get this error: NUnit has stopped Working with this message Description: Stoppe...

NAnt script for running multiple test assemblies

Hi Guys. I'm just getting into TDD, and from looking around, the general concensis seems to be to have a one to one mapping from a code project to a test project. My question is, if you follow this route, and have multiple test assemblies, what is the best way to run these as part of an NAnt script? If it makes a difference, I am using ...

NUnit, TestDriven.Net: Duplicate test results with partial test classes

I just discovered that I was getting twice the number of tests run that I should've been getting. Discovered it when a test broke and I got two identical test failures. Same test, same everything. Got me quite confused, but managed to narrow it down to a certain test class that was a partial class. The reason it was a partial class was ...

moq/Nunit - No tests are loaded or are disabled.

When I try to run the tests, I get a message saying that the tests are not loaded or are disabled. I cannot see how to enable or activate the test code that has been created. This seems to be a common error when installing/using addon Nunit or Moq but I have yet to find a link that has a solution. If you know how to solve this problem ...

how to unit test following Method, returnig value using "ref"

I have similar methods, in the Business layer. New to unit testing and sometimes get confused. For an idea, can you suggest, what will be a better approach to test this method behaviour? I am using C# NUnit and Moq public int? AddNewCatRetID(string categoryName) { int? categoryID = 0; Adapter.AddNewBlogCategoryReturnID(categ...

Mocking 3rd party callback events using moq

We've been trying write unit tests for a worker class written in C#, which mocks out a third party API (COM based) using moq to dynamically create the mock objects. NUnit is our unit testing framework. This third party component implements a couple of interfaces, but also needs to call back into our worker class using events. Our plan w...

Unit Testing with WatiN and NUnit

It seems that the common theme among SO questions regarding WatiN have to do with actually getting the thing working and I'm no exception. I've downloaded the latest release of WatiN (2.0.20.1089) and am trying to create the NUnit / WatiN equivalent of Hello, World: using WatiN.Core; using NUnit.Framework; namespace Foo.Browser.Tests ...

How to unit test a method that spawns threads?

I am fairly new to TDD but have been using it for long enough to understand how to use mocks, stubs, dependency injection, inversion of control to solve 'similar' problems... but for some reason I feel very uneasy about using dependency injection and passing in an 'IThread' (or similar). To give it some basic context - I am trying to ad...

Delete all db schema in test teardown using nhibernate

Hi All I am looking for the best way to delete all schema changes(all tables really) made when unit testing. I am using fluent to map my entities and create the schema in the Setup of my tests. I want to be able to delete the schema changes at the end of the tests in the Teardown. I am using nhibernates SchemaExport to generate the sc...

Problems getting a mocking demo working (Nunit and ReSharper)

Hi, I am trying to get to grips with mocking and ReSharper by watching this demo http://www.bestechvideos.com/2008/06/08/dimecasts-net-introduction-to-mocking-with-moq I'm sure I followed the code correctly but I'm getting errors. Could you give me some pointers as to were I'm going wrong? errors:-class name is not valid at this point e...

NUnit and Log4Net integration: asserting based on the log

Hi, This is my first question on stack overflow. I haven't had much luck finding an answer via google or stackoverflow. I'm interested in having an nunit test examine the log4net for a specific entry in the log and assert based on the results of that search. Based on an unrelated post I read re: log4net, I think I can probably use Me...

Powershell error in Executing NUnit test

Hi, This might sound silly but I have been trying to execute a NUnit test using powershell script, had several attempts but no hope. is there different format or do I need to add a plugin? Any help would be appriciated... Command = "c:\Program Files\NUnit 2.4.8\bin\nunit-console.exe" /config=Release "C:\projects\IntegrationTests\In...