Ejemplo n.º 1
0
        public void OnEvent_AcceptedEvent(CacheEntryEventType evtType, bool expectedToBeAccepted)
        {
            var mockEvent = new Mock <ICacheEntryEvent <ISiteModelChangeBufferQueueKey, ISiteModelChangeBufferQueueItem> >();

            mockEvent.Setup(x => x.EventType).Returns(evtType);

            using (var handler = new SiteModelChangeProcessorItemHandler())
            {
                var listener = new LocalSiteModelChangeListener(handler);
                listener.OnEvent(new List <ICacheEntryEvent <ISiteModelChangeBufferQueueKey, ISiteModelChangeBufferQueueItem> > {
                    mockEvent.Object
                });

                // the listener should have placed the event in to the handler
                handler.QueueCount.Should().Be(expectedToBeAccepted ? 1 : 0);
            }
        }