You can use
https://nhibernate.svn.sourceforge.net/svnroot/nhibernate/trunk/nhibernate/src/NHibernate.Test/SqlLogSpy.cs
Also you can play with Log4Net putting code around your actions, and see
what the log is raising. Like:
public void SomeTest() {
using (new SqlLogSpy()) {
log.Debug("Is going to Get()");
var person = session.Get<Person>(12345);
log.Debug("Get() executed");
}
}
Or
You can use statistics to count queries
https://nhibernate.svn.sourceforge.net/svnroot/nhibernate/trunk/nhibernate/src/NHibernate.Test/Stats/StatsFixture.cs
On Mon, Jun 1, 2009 at 1:20 AM, dnagir <[email protected]> wrote:
>
> Hi,
>
> I want to play with NH a bit in my tests to ensure I get the expected
> SQL statements.
> So I want to write code like this:
>
>
> public void SomeTest() {
> // Something here...
> using (var sqlTracker = new TrackSql(session)) {
> var person = session.Get<Person>(12345);
> Assert.AreEqual(1, sqlTracker.TotalQueries);
> }
> // Something there...
> }
>
>
> The code above is just simple case but the general aim is to check
> what queries have been executed.
> Can you suggest me a starting point for the TrackSql class? What
> interfaces should I implement (IInterseptor doesn't look like the
> correct one)...
>
> Thanks,
> Dmitriy.
>
>
--
Dario Quintana
http://darioquintana.com.ar
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---