unit

Unit Testing CacheManager

Hi, I have this CacheManager class which keeps a static dictionary with all sorts of cached data. However, with this dictionary being static it gets filled up with data from the other unit tests. This keeps me from unit testing whether or not the CacheManager is empty on init, and breaks with the principles of unit testing. Any ideas ...

Moq Exception: Verifying a method call that takes parameters

I want to test that the "Create" method on the _eventManager in my controller gets called. When I run my test, I get the following exception: Test method Baigent.TheDoNation.Application.Tests.EventControllerTest.Create_Post_IfModelIsValidRedirectToSuccessfullyCreatedViewOccurs threw exception: System.ArgumentException: Invalid setup on...

How can I inherit an inner class using an abstract base class?

I'm trying to create a test class which organizes its test methods using inner classes. I would like for this class to be abstract with the ability to set a static property so this property can be injected. Here's an example of what I'm talking about: [TestClass] public abstract class BaseUnitTest { public static string InjectedPro...

make javascript function callback-ish

Hi, i'm having a javascript function using jquery: my.namespace.loadSomeStuff = function() { $.get('/Services/loadStuff', function(c){ $("#stuffDiv").html(c); }); }; and am trying to write unit tests for this. now, since this function is not really returning anything and loading some stuff asynchronous using jquery's...

asp.net mvc nhibernate unit testing

Hello there How can I write a unit test for CRUD using in memory database with fluent nhibernate ...

How using MbUnit can I set a StaticTestFactory to be parallelized?

I have a large number of test set-up through a StaticTestFactory, but when I put any form of paralleization on it then it doesn't seem to effect it. Any ideas? ...

run method in testcase.rb ,what type should the argument be of

For the run(result) method in test/unit/testcase.rb what attribute type should my result be of .It will store the result from the error and assertions from the TestCase class i dono if it should be TestCase object or something dono.. could someone help ...

Howto create a partial mock using mockto-flex?

Is it posible to create a partial mock using mockito-flex? ...

More bugs in unit tests than in production code

I just started a new project, and now with ASP.NET MVC being designed in an extremely composable way, I figured it might be a good time to start with unit testing. Most of my code is fresh, and I'm writing the tests before I'm writing the actual production code. My frustration, though, is that I spend a lot more time fixing mistakes in ...

Practices for refactoring unit tested code

Suppose I have a function like this: public void AddEntry(Entry entry) { if (entry.Size < 0) throw new ArgumentException("Entry size must be greater than zero"); DB.Entries.Add(entry); } And a corresponding unit test: [TestMethod] [ExpectedException(typeof(ArgumentException), "Entry size must be greater than zero")] p...

xUnit or NUnit? What advantages and disadvantages of each other?

Hi Guys, what is pluses and minuses of each framework, comparing to each other? How well they work with ASP.NET MVC? How well they support mocking? ...

add test class to a test suite in ruby

I have a test class which i want to add to another test suite .. I tried testsuite< am i doing something wrong in here ...

trickle down unit tests

If I'm writing a library in C that includes a Python interface, is it OK to just write unit tests for the functions, etc in the Python interface? Assuming the Python interface is complete, it should imply the C code works. Mostly I'm being lazy in that the Python unit test thing takes almost zero effort to use. thanks, -nick ...

Proper Approach to Unit testing a "complex" application service

I have an application service (ie. large method) responsible for coordinating the interaction between several business objects. Essentially it takes a DTO from one system which contains customer information and an invoice, and translates it and imports it into a different system based on various business rules. public void ProcessQueue...

GWT: IE8 problem with composite over DockLayoutPanel, the unit EM, and the Singleton design pattern

Hi everyone, I have a "Welcome Screen" which is made by hand from the entry point. On the other side, I have Widget named Main which uses the Singleton pattern: this Widget encapsulates the application funcionality and there should be only one instance in the application. This Widget is a composite over a DockLayoutPanel, which has nor...

How can I use unit testing framework on sharepoint 2007?

Hi everyone, I have a MOSS2007 application and now I want to unit test on the application? There is any way to do that? Thanks ...

Common convention for invoking unit tests across a python project?

Is there a standard convention, or even a growing one, around where and how to invoke the tests associated with a project? In many projects, I'm seeing it bundled into a Make, a separate test.py script at the top level of the project, etc to do the work.  I looked around for some common thing with setup.py, but didn't spot anything ther...

VS 2010 Error Generating Unit Tests

I have one .NET 4 DLL for which I'm having trouble generating unit tests. I'm using VS 2010 Standard. Every other project in the solution will generate unit test stubs for classes just fine. For the other assemblies, I can go into the existing code, right click the class name, and select "Create Unit Tests". I get the selectiong wind...

MSBuild/TFS Build property for the test results out directory path

I am running a build using TFS 2008 to build a Visual Studio 2010 solution. The build is set to run unit tests, and when it does, it creates a folder such as this to hold the test results: D:\Temp\MyApp\MyApp.Dev\TestResults\MyAccount_MyBuildServerName 2010-07-29 18_07_00_Any CPU_Release\Out\ Is there a built-in property I can use in ...

Unit Testing .cpp How-To

Alright. I have done screen scrapping program in c++. Now how do i unit test a .cpp? where do i get started? ...