Esempio n. 1
0
        private void OnConfiguring(ContextBuilder builder)
        {
            var serializer = EventStoreSerializer.FromAggregateTypes(this.aggregateTypes);

            builder.EventStore = new Lazy <IEventStore>(
                () => new EventStore(this.EventStoreDb ?? new LocalEventStore(),
                                     this.EventStoreBus ?? new EventBus(builder.MessageBus.Value),
                                     serializer));
        }
Esempio n. 2
0
        public void SetUp()
        {
            this.eventStore = new EventStore(
                new LocalEventStore(),
                new Mock <IEventStoreBus>().Object,
                EventStoreSerializer.FromAggregateTypes(typeof(Sample.Counter)));

            this.queryStore = new LocalQueryStore <CounterStats>();
        }
Esempio n. 3
0
        private IAggregateRepository <Counter> CreateRaceRepository()
        {
            var bus = new Mock <IEventStoreBus>();

            bus.Setup(b => b.Publish(It.IsAny <IAggregateEvent <JObject> >()))
            .Returns(Task.FromResult(true));
            bus.Setup(b => b.Publish(It.IsAny <IEnumerable <IAggregateEvent <JObject> > >()))
            .Returns(Task.FromResult(true));

            var eventStore = new EventStore(
                new LocalEventStore(),
                bus.Object,
                EventStoreSerializer.FromAggregateTypes(typeof(Counter)));

            var repository = new AggregateRepository <Counter>(eventStore);

            return(repository);
        }