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 [...]
TypeMock Isolator is a good library to inject mock objects without the need of interfaces, but what happens when you try to run test that uses typemock isolator inside a tfs 2010 build? Clearly the tests will not succeed
If you look at test result you can check why the tests are failing
Ok, the [...]
Continue reading about Run test with TypeMockIsolator during a tfs2010 build





