public void Setup() { _consumer = new Moq.Mock <IEventStoreConsumer>(); var messaging = new Moq.Mock <IMessaging>(); _subscriber = new Aggregates.Internal.EventSubscriber(messaging.Object, _consumer.Object, 1); Bus.OnMessage = (ctx) => { _onMessaged = true; return(Task.CompletedTask); }; Bus.OnError = (ctx) => Task.FromResult(ErrorHandleResult.Handled); Bus.BusOnline = true; }
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); var messaging = new Moq.Mock <IMessaging>(); _subscriber = new Aggregates.Internal.EventSubscriber(_metrics.Object, messaging.Object, _consumer.Object, 1); }