nunit

Cruise Control.NET, NUnit integration

Hi, I currently have a code base which has NUnit tests organised into suites. We currently have a build task on our CC box which runs all of the tests in one CC project. Is there a way we can configure CC.Net to allow us to individually run the different test suites from the dashboard. Something along the lines of a list of all the su...

Testing controller Action that uses User.Identity.Name

Hello, I have an action that relies on User.Identity.Name to get the username of the current user to get a list of his orders: public ActionResult XLineas() { ViewData["Filtre"] = _options.Filtre; ViewData["NomesPendents"] = _options.NomesPendents; return View(_repository.ObteLiniesPedido(User.Identity.Name,_...

Are there MSTest collection constraints that are similar to NUnits

I am working on a project utilizing MSTest and I need similar constraints for testing arrays/lists that NUnit provides (http://www.nunit.org/index.php?p=collectionConstraints&r=2.4.8) Is there anything similar built-in or as an add-on to the MSTest framework? ...

TDD - How to write test case for a method that as Assembly.LoadFrom(...)

I have got method which is using Assembly.LoadFrom(...) statement and returns the supported cultures from that satellite assembly, so how could I write unit tests for that type of methods. What I did was, wrapped that static method/logic to return cultures in anther class and used it's instance method. Is this the right approach? ...

Is there a C++ unit testing library that is similar to NUnit?

We need to migrate a unit test harness developed with C# and NUnit to C++ running on Red Hat Linux. We want to minimize the efforts in migration. We are reading resources such as this: http://gamesfromwithin.com/exploring-the-c-unit-testing-framework-jungle But we don't see anything similar to NUnit. ...

How to diagnose "TestFixtureSetUp Failed"

We use TeamCity as our CI server, and I've just started seeing "TestFixtureSetUp Failed" in the test failure window. Any idea how I go about debugging this problem? The tests run fine on my workstation (R# test runner in VS2008). ...

How do you instruct NUnit to load an assembly's dll.config file from a specific directory?

If an assembly contains an app.config file, ConfigurationManager will load it as long as it is in the same directory as the NUnit project that is executing through NUnit-Gui. To illustrate consider the following folder structure. + TestFolder testProject.nunit + AssemblyAFolder assemblyA.dll assemblyA.dll.config + A...

Resharper Unit Test Runner significantly slower than NUnit console

Resharper Unit Test Runner runs significantly slower than nunit-console or nunit gui. For example, 3800 tests take just over 60 seconds via nunit-console, but those same tests take over 5 minutes to run in Resharper Unit Test runner. Why such a significant difference? Since our test code base has grown significantly, this is really ...

Unit Testing WPF UserControls

Is it possible to test my WPF UserControls from NUnit (or similar)? If I create an instance of the usercontrol in a unit test like so: // Create an instance of the WPF UserControl var view = new ChildrenListView(); I get the following error: "The calling thread must be STA, because many UI components require this" I get the feeling...

What's the "upgrade path" from Assertion.AssertEquals ?

I've inherited some unit test code which is giving me a deprecation warning because it uses "Assertion.AssertEquals": warning CS0618: 'NUnit.Framework.Assertion' is obsolete: 'Use Assert class instead' However, I can't see the obvious method in the Assert class that I should be using instead? AssertEquals takes two objects and a messa...

Are there any plans for Microsoft to support testing frameworks other than MSTest?

It seems like you should be able to configure your preferred unit testing framework as a plugin to Visual Studio/Team system like you can with SourceControl providers. Is anyone aware of an effort within microsoft to allow for swapping out MStest for nUnit, mbUnit or others. Obviosly nothing prevents me from using these other frameworks...

NUnit executes with alternate constructor

I have a class which has some unit tests, but when I am running tests I would like the class to be created with a different constructor. Something like this: [TestFixture] public class MyClass { public MyClass() { /* set up for production */ } [TestFixtureConstructor] public MyClass() { /* set up for testing */ } [Test...

xUnit.net Test Stripper [to remove test code embedded in binaries prior to deployment/shipping]

Is there a Test Stripper (as defined in xUnit Test Patterns) available that supports removing classes containing methods tagged as [Fact]s etc. plus the dependency on xunit.dll from binaries [as part of a build process] ? Further details of the full requirements and context are at this xUnit CodePlex post. Failing that (something that ...

Integration testing C++ code from NUnit in managed code

I have a library written in c++ that I want to end-to-end test from C# via interop. Basically this library takes in some parameters and spits out a file at the other end. I want to pass requests to a com interop and then assert that all the data was written correctly to the file. Is it possible to do this? Is there an easier way? Using ...

is testing the public API enough for unit testing an API component?

Hi, My software (application) exposes an API (webservices) using httplistener. Is it from a unit test point of view enough to test the API functions through web requests? I ask this since I read that a best practice is to test only the public methods of a class. In this case I'm not testing public methods of a class but the public API ...

TDD in a text file import project

I'm just starting, and yes, i haven't written any tests yet (I'm not a fundamentalist, I don't like compile errors just because there is no test), but I'm wondering where to get started on doing a project that parses fixed length flat file records according to an XML mapping, into a class that represents the superset of all file layouts,...

Is there a TFS check-in policy for Nunit and NCover?

Hi. I would like to enforce my users to run unit tests and code coverage, but we are using Nunit and NCover, not MS Team system unit test\ coverage framework. How canI do it? Is there a matching check-in policy? Thanks ...

Can I make NUnit execute tests in random order?

Greetings, I would like to make NUnit execute my unit tests in a random order every time in order to ensure they are isolated and FIRST. Does anyone know of a easy way to do this well without branching NUnit? ...

UAC Testing with Website Generated Email

We would like to use Selenium to test email content generated from our website. We could mock a mail server, but how would we assert the content of the emails? We're using nUnit/Selenium/C#. Does anyone have a good approach to accomplishing this? Thanks in advance! ...

How do I use a persistent object between NUnit test objects?

I'm planning on implementing some tests using nUnit. I also have a homegrown metrics recording library that I'd like to use to use to get some metrics out of the test. Said metrics library is normally used in applications, and is usually used something like this: // retrieve configuration. string path = GetPath(); bool option = GetOpt...