Oren Eini

CEO of RavenDB

a NoSQL Open Source Document Database

Get in touch with me:

oren@ravendb.net +972 52-548-6969

Posts: 7,503
Comments: 51,091
Privacy Policy · Terms
filter by tags archive
time to read 1 min | 79 words

I want to be able to see the return value of a function in the debugger. I can recall something similar in VC++ 6.0, and knowing MS, it probably didn't go away on its own. Is it still possible in VS.Net?

I'm talking about the return value of a function like:


Currently I need a (redundant) variable if I want to check the return value.

time to read 1 min | 121 words

Sorry for not releasing it today, but I was veyr busy all day, and didn't had time to do much about the article. I did find a bug in Rhino Mocks, it only affect code that uses nested orderring and SetupResult, but when I fixed it, I realized that this is a good opportunity to fix the whole nested orderring before I ship the second version, and that took quite a bit of time.

I had a very interesting technical discussion about the logic of nested orderring with some very non technical people, I think we designed this feature for about an hour and a half. A lot of fun.


time to read 1 min | 195 words

This time it is from  Jeremy Miller [The Shade Tree Developer]

“The legacy code was so tightly coupled that if you put a chunk of coal between the classes you would get a diamond.”

Another thing that caught my eye:

Twice in the last year I’ve transitioned from greenfield development projects that were written with TDD to working with brownfield code that had not been written with TDD. In almost startling contrast, the test-first code was vastly easier to extend with new unit tests than the code written test-last.

I feel the exact same pain in NQA currently. Even after all the major refactoring that went there. In comparision, it's a joy to work on Rhino Mocks, because it was developed Test First.

time to read 4 min | 606 words

This is just a quicky, doesn't mean much, but allows a look at how each framework's syntax allows to setup a expectation & return value for a method:


IMock mock = new DynamicMock(typeof(IRequest));
IRequest request = (IRequest)mock.MockInstance;


MockControl control = MockControl.CreateControl(typeof(IRequest));
IRequest request = (IRequest)control.GetMock();

TypeMock.Net: [Update: This is the correct syntax] 

Mock requestMock = MockManager.Mock(typeof(ConcreteRequest));
//TypeMock.Net should take care of intercepting the calls for Username
testedObject.HandleRequest(new ConcreteRequest());

Rhino Mocks Version 1.0:

MockControl mockRequest = MockControl.CreateControl(typeof(IRequest));
IRequest request = (IRequest)mockRequest.MockInstance;


using(Mockery mocks = new Mockery())
  IRequest request = (IRequest)mocks.NewMock(typeof(IRequest),"IRequest");

Rhino Mocks Version 2.0:

using(MockRepository mocks = new MocksRepository)
   IRequest request = (IRequest)mocks.CreateMock(typeof(IRequest));

Anyone wants to guess who get this editor's prize? :-)

time to read 3 min | 587 words

[Note: This is another post where I just added over several hours as I added the finishing touches for Rhino Mocks.]

I found out something nice about Rhino Mocks, it allows you to specify ordered sequences of unordered method calls. Meaning that I can specify that calls A, B & C would occur in any order, and only after those three calls, the calls for D, E & F would occur (in that order, or in any order). I'm not very clear, but I'm working on an article that should explain it all, and expose all the nice things that Rhino Mocks 2.0 can do :-)

That is not something that I put it. I debugged it, and I thought that this was just a freak chance, but apperantly another feature I put it (adding IDisposable to verify mocks*) prevented it from being fully useful. I had to add three lines of code to handle the situation, and that was that. The reverse behaviour shouldn't be possible (I think, Rhino Mocks surprised me before tested it, as expected, it doesn't work)  so currently I don't think you can say "Do X then Y then Z, Do A then B the C, but I don't care if XYZ is first, or ABC". It wouldn't be too hard to add this, but I currently don't need it, if you think this would be useful, tell me and I'll add it.

Interestingly, I found that as I neared completion, I needed less and less code to do what I want, some thing just happened, without having to add any more code, and the rest was a matter of adding a derived class and a way to call it.

A lot of the effort was spend in making the code easier to read and write. In this, I am quite inspired by NMock2 and it's use of Matchers (what NMock & Rhino Mocks call constraints) and how easy it is to use. I'm currently moving NQA to use the new version** of Rhino Mocks. It's actually fun, and I added some nicer syntax options for recording expectations. The nicer thing is that I got rid of some warts that were there because the Rhino Mocks 1.0 used Remoting, and there were several places where that leaked through. {Having to inherit from MarshalByRef to get a proxy for a concrete class, can't do normal comparision, etc}.

I'm very glad that I spent a lot of time perfecting the error messages, I make purposefully a lot of mistakes trying to convert from one version to the other, and it's good to see how easy it is to solve them using Rhino Mocks. I'm finding my share of bugs in the tests. Things that work properly, but just because the code isn't checking them well enough, or version 1.0 allowed them to slip through, and the version 2.0 doesn't.

01:00 AM: I've finally moved all of NQA to use Rhino Mocks version 2.0, it's been very educating. I've a lot of info to write that article about. Four pages of just headnotes :-) I expect to be done with the article and documentation and be able to officially release it tomorrow.

* It actually makes sense, wait for the article.

** This is the second time already, this time I'm keeping the syntax, it's too much work.

time to read 2 min | 218 words

AngryPets' ReverseDOS

I read about it quite a bit, and after tha last round of trackback spams, which dasBlog still doesn't handle, I decided to give it a try. The webseite is very clear, and the installation is a piece of cake. Drop the file in the bin folder, add some lines in Web.Config, and you're done.

The nice thing about it is that it should stop a wide range spams (comments, CommentAPI, refferers, trackbacks) using a single tool and without modifying the application at all. It's like Ascpecting the application.

If you've a blog and want to reduce spam, check it out.

"A man sits with a pretty girl for an hour, it seems like a minute. He sits on a hot stove for a minute, it's longer than any hour. That is relativity." -- Albert Einstein
"A book is like a garden carried in the pocket." -- arab proverb
""I have PMS and a handgun. Any questions?" (I saw this on the back of a porsche 911 ... kinda makes you think :)" -- Bumper Sticker

[Listening to: Hawk Brother - Mercedes Lackey & Heather Alexander - (04:57)]


No future posts left, oh my!


  1. Recording (14):
    19 Jun 2024 - Building a Database Engine in C# & .NET
  2. re (33):
    28 May 2024 - Secure Drop protocol
  3. Meta Blog (2):
    23 Jan 2024 - I'm a JS Developer now
  4. Production postmortem (51):
    12 Dec 2023 - The Spawn of Denial of Service
  5. Challenge (74):
    13 Oct 2023 - Fastest node selection metastable error state–answer
View all series


Main feed Feed Stats
Comments feed   Comments Feed Stats