Adding a mocking library to NHibernate.Tests

39 views
Skip to first unread message

Gunnar Liljas

unread,
Oct 16, 2017, 5:26:55 PM10/16/17
to nhibernate-development
Hi guys!

What do you think about adding a mocking library to the test projects. The ones I've used extensively are Moq and NSubstitute, and I like them both.

Why? Well, some tests call for a bit more decoupling, and if for example you want to count how many times a method has been called, it's sometimes a bit much work to have to implement your own mocks. Also, to some extent, using mocks and more slim lined unit tests serves to highlight architectural issues. Using full blown database tests is good, and it's mostly a benefit to the project, but not always.

/G

Frédéric Delaporte

unread,
Oct 17, 2017, 3:39:39 AM10/17/17
to nhibernate-development
Yes, NHibernate current tests are more integration tests than unit tests, strictly speaking.

A benefit of having "true" unit test would be to have them normally more lightweight. The builds are already taking 15 minutes each per database at minimum. So this could help reducing the ever increasing build time.

So why not.

Gunnar Liljas

unread,
Oct 17, 2017, 8:36:40 AM10/17/17
to nhibernate-development
Ok, good! I'll use NSubstitute for one current issue, and you can accept or reject it in review. Just as a POC.

/G
Reply all
Reply to author
Forward
0 new messages