Ejemplo n.º 1
0
        public void Setup()
        {
            _consumer   = new Moq.Mock <IEventStoreConsumer>();
            _subscriber = new Aggregates.Internal.DelayedSubscriber(_consumer.Object, 1);

            Bus.OnMessage = (ctx) =>
            {
                _onMessaged = true;
                return(Task.CompletedTask);
            };
            Bus.OnError   = (ctx) => Task.FromResult(ErrorHandleResult.Handled);
            Bus.BusOnline = true;
        }
Ejemplo n.º 2
0
        public void Setup()
        {
            _metrics    = new Moq.Mock <IMetrics>();
            _consumer   = new Moq.Mock <IEventStoreConsumer>();
            _dispatcher = new Moq.Mock <IMessageDispatcher>();

            var fake = new FakeConfiguration();

            fake.FakeContainer.Setup(x => x.Resolve <IMetrics>()).Returns(_metrics.Object);
            fake.FakeContainer.Setup(x => x.Resolve <IEventStoreConsumer>()).Returns(_consumer.Object);
            fake.FakeContainer.Setup(x => x.Resolve <IMessageDispatcher>()).Returns(_dispatcher.Object);

            Configuration.Settings = fake;

            _dispatcher.Setup(x => x.SendLocal(Moq.It.IsAny <IFullMessage[]>(), Moq.It.IsAny <IDictionary <string, string> >())).Returns(Task.CompletedTask);

            _subscriber = new Aggregates.Internal.DelayedSubscriber(_metrics.Object, _consumer.Object, _dispatcher.Object, 1);
        }