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> >()); } }