Tests for NH-3731

Description in https://nhibernate.jira.com/browse/NH-3731