public void SetupTest() { _session = Substitute.For <ISessionImplementor>(); _factory = Substitute.For <ISessionFactoryImplementor>(); _persister = Substitute.For <IEntityPersister>(); _session.Factory.Returns(_factory); _factory.GetAllClassMetadata().Returns(new Dictionary <string, IClassMetadata> { ["TestClass"] = null }); _factory.GetEntityPersister("TestClass").Returns(_persister); _factory.GetCollectionRolesByEntityParticipant("TestClass").Returns(new HashSet <string>(new[] { "TestClass.Children" })); _persister.QuerySpaces.Returns(new[] { "TestClass" }); _persister.EntityName.Returns("TestClass"); }