public void AfterTransactionCompletionProcess_EvictsFromCache(string querySpaces, bool persisterHasCache, int expectedPropertySpaceLength, int expectedEntityEvictionCount, int expectedCollectionEvictionCount)
        {
            _persister.HasCache.Returns(persisterHasCache);

            var target = new BulkOperationCleanupAction(_session, new HashSet <string>(querySpaces.Split(new [] { ',' }, StringSplitOptions.RemoveEmptyEntries)));

            target.AfterTransactionCompletionProcess(true);

            Assert.AreEqual(expectedPropertySpaceLength, target.PropertySpaces.Length);

            if (expectedEntityEvictionCount > 0)
            {
                _factory.Received(1).EvictEntity(Arg.Is <IEnumerable <string> >(x => x.Count() == expectedEntityEvictionCount));
            }
            else
            {
                _factory.DidNotReceive().EvictEntity(Arg.Any <IEnumerable <string> >());
            }

            if (expectedCollectionEvictionCount > 0)
            {
                _factory.Received(1).EvictCollection(Arg.Is <IEnumerable <string> >(x => x.Count() == expectedCollectionEvictionCount));
            }
            else
            {
                _factory.DidNotReceive().EvictCollection(Arg.Any <IEnumerable <string> >());
            }
        }
        protected virtual void CoordinateSharedCacheCleanup(ISessionImplementor session)
        {
            var action = new BulkOperationCleanupAction(session, AffectedQueryables);

            if (session.IsEventSource)
            {
                ((IEventSource)session).ActionQueue.AddAction(action);
            }
            else
            {
                action.AfterTransactionCompletionProcess(true);
            }
        }