First time here? You are looking at the most recent posts. You may also want to check out older archives or the tag cloud. Please leave a comment, ask a question and consider subscribing to the latest posts via RSS. Thank you for visiting! (hide this)

Rhino Mock

There are 2 entries for the tag Rhino Mock

Rhino Mocking NHibernate Expressions

A few days ago I wrote a post about how to test your business layer using Rhino Mocks. Last time I set an expectation on an method that accepts a normal int. Today I'll show how to work on something more complicated: a NHibernate Expression. How to Mock the FindOne(ICriterion[]) I've to test a method that returns a user given its username. 1: public User GetByUsername(string username) 2: { 3: User returnUser = 4: _repository.FindOne(Expression.Eq("EmailAddress", username)); ...

How to mock a NHibernate Repository

 In my current project I'm trying to apply the best practices for building "great software" (cit.). One of the best practices is using a (kind of) TDD approach, using Inversion of Control and Dependency Injection to test only the relevant parts of your code without testing all the layers of your applications, DB included, during each test. Which are the benefits of this approach? First of all your tests run quicker because they are not hitting the database all the times. Second, you don't need to restore the initial state for the database. Third, if you are...