title: How to test service layer which directly uses NHibernate?
body: <p>Hello can anyone give me advice on how to test my service layer which uses NHibernate <code>ISession</code> directly?</p>
  
  <pre><code>public class UserAccountService : IUserAccountService
  {
      private readonly ISession _session;
  
      public UserAccountService(ISession session)
      {
          _session = session;
      }
  
      public bool ValidateUser(string email, string password)
      {
          var value = _session.QueryOver&lt;UserInfo&gt;()
              .Select(Projections.RowCount()).FutureValue&lt;int&gt;().Value;
  
          if (value &gt; 0) return true;
          return false;
      }
  }
  </code></pre>
  
  <p>I opt to use NHibernate directly for simple cases like simple query,validations and creating/updating records in the database. Coz i dont want to have an abstraction like repository/dao layer on top of Nhibernate that will just add more complexity to my architecture.</p>