Recent Posts

How do you test a system that self optimize itself? by Test Driven Development

I have a system in which one of the core parts is required to work in a non deterministic fashion. In particular, some part of the system is behaving randomly (by design). Here is a small description: 90% of the time, we select only items that are above...

Recursive Mocking by Rhino Mocks

This now works :-) The challenge is still open, I intentionally stopped before completing the feature, and there is a failing test in the RecusriveMocks fixture that you can start from. And just to give you an idea about what I am talking about, please...

Request for comments: Changing the way dynamic mocks behave in Rhino Mocks by Rhino Mocks

I have just committed a change to the way Rhino Mocks handles expectations for dynamic mocks and stubs. Previously, the meaning of this statement was "expect Foo() to be called once and return 1 when it does": Expect.Call( bar.Foo ).Return(1...

Rhino Mocks 3.5 Gems - Explicit Property Setting Expectations by Rhino Mocks

This post is derived from the Rhino Mocks 3.5 documentation . Setting expectations for property set was always very simple, and slightly confusing with Rhino Mocks. Here is how you do it: view.Username = " the user name "; The problem is that...

Rhino Mocks Challenge: Implement This Feature by Rhino Mocks

Okay, let us see if this approach works... Here is a description of a feature that I would like to have in Rhino Mocks (modeled after a new feature in Type Mock). I don't consider this a complicated feature, and I would like to get more involvement...

Rhino Mocks 3.5 RTM by Rhino Mocks

Today I decided that I had enough time to get bugs for the 3.5 RC, so I fixed all the remaining bugs, updated the Rhino Mocks 3.5 Documentation , and put the binaries out the site . For this release, I actually have 4 binary packages. One for .NET 3.5...

Meta tests by Test Driven Development

I found this test fixture hilarious. [TestFixture] public class ValidateNamingConventions { private System.Type[] types; [SetUp] public void Setup() { types = typeof (ISearchFactory).Assembly.GetExportedTypes(); } [Test] public void InterfacesStartsWithI...

Legacy Driven Development by Test Driven Development

Here is an interesting problem that I run into. I needed to produce an XML document for an external system to consume. This is a fairly complex document format, and there are a lot of scenarios to support. I began to test drive the creation of the XML...

An example of bad test, part 2 by Test Driven Development

Let us take a look at this test. When I saw it, the code under test called to me: "Help me, I being intimately harassed here!" The problem is that this tests knows all sorts of unrelated things about the code under test. It knows that it should...

An example of bad test, part 1 by Test Driven Development

Let us take a look at this test. When I saw it, the test cried out in pain to me: "Help me, I am so overworked." This test is doing far too much. I drew the battle line on the test, just to give you a clear indication on what is going on. What...

Inversion of Control is NOT about testability by Test Driven Development

Jacob have an interesting perspective on testability: The thing is that using Typemock means that you can unit test literally any public method of any public class, regardless of any and all internal dependencies that class might have. And you can do...

How .Net 3.5 SP1 broke Rhino Mocks by Rhino Mocks

Okay, now that we are over the sensationalist headline, the actual problem is more complex than that. Let us assume that we have the following interface: public interface IComplexGeneric<T> { void GenericMethod<K>(); } Up until .Net 3.5 SP1...

No testing, no software by Test Driven Development

I just tried to spike something, and as usual, I created a console app and started hacking. It is a non trivial spike, so I started refactoring it to allow proper separation and actually let me handle the complexity that I am trying to contain. I couldn't...

Mocking the file system by Rhino Mocks

I have the following piece of code: And I wasn't sure about how I can test this thing. For production, this will use a File Stream, and getting those to produce errors is non trivial in most situations. A bit of thinking, however, told me that I can...
More Posts Next page »