Sometimes there is the need to change the return value of an expectation to a Mock with a value based on parameters used in the call. Suppose you need to create a mock, and want to verify that the method DoInt() gets called with a value greater than 42 and it should return the value [...]
Continue reading about Change return value of a mock based on parameters in Rhino mocks
I’ve a project where I wrote all nhibernate mapping tests against a sqllite db. At this time a test fixture gave me this result.
44 passed, 0 failed, 0 skipped, took 54,46 seconds (NUnit 2.5.5).
As you can see the time needed to run the test is quite high, and the worst stuff is that is [...]
I use a custom version of AutoMockingContainer based on the class used in this blog. The standard approach does not work for object that depends on some interface in the constructor, but actually uses that interface in the constructor and you need to set expectation on it.
Basically you need a way to intercept the generation [...]
Continue reading about AutoMockingContainer and mock used in the constructor
One of the reason why people do not write tests, is that some code is difficult to test, and one of the main reason for this difficulty is coupling. The obvious solution is to write loosely coupled code from the beginning, but if you are working with legacy code this option is not applicable.
The problem [...]
I’m creating some web tests with Visual Studio to test an application in an end-to-end fashion. This is absolutely not a unit test, but I want to be able to launch a series of automatic tests against a web server to verify if the whole site satisfy an initial set of core requirements.
One of this [...]





