Ayende @ Rahien

Hi!
My name is Ayende Rahien
Founder of Hibernating Rhinos LTD and RavenDB.
You can reach me by phone or email:

ayende@ayende.com

+972 52-548-6969

@

Posts: 5,947 | Comments: 44,543

filter by tags archive

Hibernating Rhinos - Episode #1: Rhino Mocks 101


To celebrate the Rhino Mocks 3.0 release, I produced a screen cast of about an hour, talking about how you can use it. This is the very first time that I am doing something like this, so the list of fubars in this episode is fairly long. For instance, I didn't realize that the Play/Pause bar would appear in the final movie, or thought about closing the IM during recording, etc.

At any rate, I think that this could provide a gentle introuction to Rhino Mocks, and help understand how to use it. The first few minutes are introductions and power point, but from then on, it is all code, so have fun.

You can watch it here.

Oh, and happy mocking.

Hibernating RhinosIntroduction


Hibernating Rhinos is a series of screen casts that I am going to make, basically they include me, a microphone, code and Camtasia.The sound quality is going to be aweful, I presume, and it turn out that I speak English sloowly. It may very well be the case that I can type English faster than I can speak it.

I guess that I don't need to explain the choice of the name, but I am still looking for a logo / picture that I can use.

My editing skills are even more limited than my UI skills, so you are going to see some funny stuff, probably, but I hope to learn to do better. Feel free to send suggestions, comments, etc to me. No fixed time, not fixed subject.

The first topic is Rhino Mocks, basically an introduction to what it can do. The second topic is going to be about MonoRail. Beyond that, feel free to suggest topics, but I will say out front that I'll not be able to do them all.

When pressed for answers...


Q: How will you do this?
A: Web Service

Q: How will you do this?
A: BizTalk

Q: When will it be done?
A: Later

Q: When will it be done?
A: Count the links in the screenshot, I do a link a week.

The first two are usually good answer for a lot of questions, up to and including walking the dog and making coffee. The last two are useful for UI changes.

Rhino Mocks 3.0 Released!


I gave it a few weeks outside, and quite a few people downloaded and tried it, so I am feeling good about it. I had a surprised that kept me from release the 3.0 for a while, but I'll talk about it later.

The binaries and code are in their usual place, here.

(Image from clipboard).png

BREAKING CHANGES:

  • Moved all the constraints to Rhino.Mocks.Constraints namespace. This was done to avoid conflicts with NUnit and MbUnit's new assert syntax.

New features:

  • Generic Methods (at last!)
  • Support arrays of value types as out parameters
  • Support non-CLS Compliant value types such as UInt64
  • Better error messages when using generic delegate methods on generic types
  • Generally faster
  • Using Dynamic Proxy 2 - better performance, better code-base, full support for weird generic scenarios.
  • Text.* constraints can now be used to evaluate non strings as well, by calling the ToString() method. Useful for things such as the Criteria API in NHibernate.

Changes:

  • The CallOriginalMethod() was deprecated, you are now encouraged to use CallOriginalMethod(OriginalMethodOptions.NoExpectation) or CallOriginalMethod(OriginalMethodOptions.CreateExpectation) instead. The reasoning behind the change is that currently CallOriginalMethod looks like it create an expectation, but it doesn't really does it,  it is better to be explicit about the whole thing.
  • The build script will internalize almost everything no related to Rhino Mocks (Except AbstractInvocation) - prevent conflicts from users that uses both Dynamic Proxy and Rhino Mocks - i.e, me).

Bug fixes (from previous 3.0 Beta):

  • Fixed regression with closed generic types inheriting from open generic types that contains generic properties of the generic type, if the property is overriden
  • Fixed issues with the generic method return values.
  • Regression with closed generic types inheriting from open generic types that contains generic properties of the generic type, if the property is overriden
  • Fixed a problem with the new semantics of CallOriginalMethod
  • Fixed a problem mocking internal types that are not nested
  • Fixed a misleading exception when you pass a mock object of type that override ToString() to an unexpected method.
  • Fixing another issue with AbstractExpectation not checking the real return type of generic methods.
  • Fixed issue with generic method call on generic type for interfaces
  • Fixing an issue with BackToRecord no clearing originalMethodsToCall expectations.
  • Improved support for wacky generics scenarios.
  • Better support for types having non inheritable attributes that cannot be easily replicated.
  • Better support for types implementing interfaces by using a base class that is located in another assembly.

NHibernate Migration Guide: From 1.0 to 1.2


Billy McCafferty may have intended just to give a sample of how to move from NHibernate 1.0 + my NHibernate.Generics to NHibernate 1.2, but his post is actually a very good guide about migrating in general from 1.0 to 1.2.

The part that you really want to do is in the end, where you want to verify that:

  • Do updates to a child, via the parent, still work?
  • Do creations of new children, added to the parent, persist to the database?
  • Do deletions of existing children from the parent, or by deleting the child directly, work correctly?
  • Have other CRUD, cascade scenarios been tested?

I have said it before, I trust NHibernate to manage my objects, but I want to verify that what I think the mapping are, and what they are actually doing are the same. Cascading and lazy loading are two of the most important parts that you want to verify when you migrate, and you really should make sure that you have working tests before you do it. For the rest, check out Billy's post.

Linq for NHibernate Updates: Adding a new committer


Following several good patches, I have added Bobby Diaz to the Rhino Tools project, which currently includes the Linq for NHibernate implementation as well. I expect that the new stuff will be up in the repository shortly.

Just to remind you, I am still looking for more volunteers to help with the implementation, so if you are into futuristic technologies, just dive right into the code and the implementation details. And be sure to send me (or Bobby) a patch or two.

Data Migrations Woes


For some reason, customers insist on putting their data in a database, which is all fine and dandy. But then they also insist on taking it out! Which is hardly fine at all.

The fun part starts when the source is a little known database called Oracle, and the destination is a new arival from out of town, who goes by the nick name SQL Server.

Fun stuff that I run into today:

  • PK in Oracle are Number, in SQL Server, it is interpreted as double or float. Do try to query for Id = 12324.432154
  • Wierd PK - such as 1,001,0004,001,000 - a real PK that I run into today. No idea how it got to this point.

I am using both P/L SQL Developer and SQL Plus, and I have to say that both have some distinct advantages over SQL Server Management Studio. Just Ctrl+Click is an invaluable assest when you try to figure out what you are doing.

WatiN + MbUnit


Verifying invalid input...

[RowTest]

[Row(null)]

[Row("")]

[Row("-12314132")]

[Row("foobar")]

[Row("very_long_string_very_long_string_and_so_on_for_another_512_chars")]

public void TryingToEnterWithInvlidPolicyNumberShowsError(string id)

{

    Open("PolicyRequests/NewRequest.aspx?Id="+id);

    AssertNoError();

    AssertContainsText("Can't find Policy with id #"+id,"Should give error message for invalid input");

}

FUTURE POSTS

No future posts left, oh my!

RECENT SERIES

  1. RavenDB Sharding (3):
    22 May 2015 - Adding a new shard to an existing cluster, splitting the shard
  2. The RavenDB Comic Strip (2):
    20 May 2015 - Part II – a team in trouble!
  3. Challenge (45):
    28 Apr 2015 - What is the meaning of this change?
  4. Interview question (2):
    30 Mar 2015 - fix the index
  5. Excerpts from the RavenDB Performance team report (20):
    20 Feb 2015 - Optimizing Compare – The circle of life (a post-mortem)
View all series

RECENT COMMENTS

Syndication

Main feed Feed Stats
Comments feed   Comments Feed Stats