コード例 #1
0
        public EventReceiverTests()
        {
            var events = new[]
            {
                new StoredEvent(3, 3, eventData1),
                new StoredEvent(4, 4, eventData2),
                new StoredEvent(5, 5, eventData3)
            };

            consumerName = eventConsumer.Object.GetType().Name;

            var eventStore = new MyEventStore(events);

            eventConsumer.Setup(x => x.Name).Returns(consumerName);
            eventConsumerInfoRepository.Setup(x => x.FindAsync(consumerName)).Returns(Task.FromResult <IEventConsumerInfo>(consumerInfo));

            formatter.Setup(x => x.Parse(eventData1)).Returns(envelope1);
            formatter.Setup(x => x.Parse(eventData2)).Returns(envelope2);
            formatter.Setup(x => x.Parse(eventData3)).Returns(envelope3);

            sut = new EventReceiver(formatter.Object, eventStore, eventNotifier.Object, eventConsumerInfoRepository.Object, log.Object);
        }
コード例 #2
0
        public EventReceiverTests()
        {
            var events = new[]
            {
                new StoredEvent("3", 3, eventData1),
                new StoredEvent("4", 4, eventData2),
                new StoredEvent("5", 5, eventData3)
            };

            consumerName = eventConsumer.GetType().Name;

            var eventStore = new MyEventStore(events);

            A.CallTo(() => eventConsumer.Name).Returns(consumerName);
            A.CallTo(() => eventConsumerInfoRepository.FindAsync(consumerName)).Returns(Task.FromResult <IEventConsumerInfo>(consumerInfo));

            A.CallTo(() => formatter.Parse(eventData1)).Returns(envelope1);
            A.CallTo(() => formatter.Parse(eventData2)).Returns(envelope2);
            A.CallTo(() => formatter.Parse(eventData3)).Returns(envelope3);

            sut = new EventReceiver(formatter, eventStore, eventConsumerInfoRepository, log);
        }