Beispiel #1
0
        public void Setup()
        {
            var eventStore     = new TestEventStore();
            var eventPublisher = new TestEventPublisher();
            var snapshotStore  = new TestSnapshotStore();
            var rep            = new Repository <TestSnapshotAggreagate>(eventStore, snapshotStore, eventPublisher);

            _aggregate = rep.Get(Guid.NewGuid());
        }
        public When_getting_an_aggregate_with_snapshot()
        {
            var eventStore         = new TestInMemoryEventStore();
            var snapshotStore      = new TestSnapshotStore();
            var snapshotStrategy   = new DefaultSnapshotStrategy();
            var snapshotRepository = new SnapshotRepository(snapshotStore, snapshotStrategy, new Repository(eventStore), eventStore);
            var session            = new Session(snapshotRepository);

            _aggregate = session.Get <TestSnapshotAggregate>(Guid.NewGuid()).Result;
        }
Beispiel #3
0
        public GetAnAggregateWithASnapshotTest()
        {
            var eventStore         = new TestInMemoryEventStore();
            var snapshotStore      = new TestSnapshotStore();
            var snapshotStrategy   = new DefaultSnapshotStrategy(snapshotStore);
            var snapshotRepository = new SnapshotRepository(snapshotStore, snapshotStrategy, new Repository(eventStore), eventStore);
            var session            = new Session(snapshotRepository);

            _aggregate = session.GetAsync <TestSnapshotAggregate>(Guid.NewGuid().ToString()).Result;
        }
Beispiel #4
0
        public void Setup()
        {
            var eventStore         = new TestInMemoryEventStore();
            var snapshotStore      = new TestSnapshotStore();
            var snapshotStrategy   = new DefaultSnapshotStrategy();
            var snapshotRepository = new SnapshotRepository(snapshotStore, snapshotStrategy, new Repository(eventStore), eventStore);
            var session            = new Session(snapshotRepository);

            _aggregate = session.Get <TestSnapshotAggregate>(Guid.NewGuid());
        }
Beispiel #5
0
        public When_getting_not_snapshotable_aggreate()
        {
            var eventStore = new TestEventStore();

            _snapshotStore = new TestSnapshotStore();
            var snapshotStrategy = new DefaultSnapshotStrategy();
            var repository       = new SnapshotRepository(_snapshotStore, snapshotStrategy, new Repository(eventStore), eventStore);
            var session          = new Session(repository);

            _aggregate = session.Get <TestAggregate>(Guid.NewGuid()).Result;
        }
        public GetNotSnapshotableAggregateTest()
        {
            var eventStore = new TestEventStore();

            _snapshotStore = new TestSnapshotStore();
            var snapshotStrategy = new DefaultSnapshotStrategy(_snapshotStore);
            var repository       = new SnapshotRepository(_snapshotStore, snapshotStrategy, new Repository(eventStore), eventStore);
            var session          = new Session(repository);

            _aggregate = session.GetAsync <TestAggregate>(Guid.NewGuid().ToString()).Result;
        }
Beispiel #7
0
        public void Setup()
        {
            var eventStore     = new TestInMemoryEventStore();
            var eventPublisher = new TestEventPublisher();

            _snapshotStore = new TestSnapshotStore();
            var snapshotStrategy = new DefaultSnapshotStrategy();
            var repository       = new SnapshotRepository(_snapshotStore, snapshotStrategy, new Repository(eventStore, eventPublisher), eventStore);
            var session          = new Session(repository);

            _aggregate = session.GetAsync <TestSnapshotAggregate>(Guid.NewGuid()).Result;
        }
        public void Setup()
        {
            var eventStore         = new TestInMemoryEventStore();
            var eventPublisher     = new TestEventPublisher();
            var snapshotStore      = new TestSnapshotStore();
            var snapshotStrategy   = new DefaultSnapshotStrategy <ISingleSignOnToken>();
            var aggregateFactory   = new AggregateFactory(new TestDependencyResolver());
            var snapshotRepository = new SnapshotRepository <ISingleSignOnToken>(snapshotStore, snapshotStrategy, new Repository <ISingleSignOnToken>(aggregateFactory, eventStore, eventPublisher, new NullCorrelationIdHelper()), eventStore, aggregateFactory);
            var session            = new UnitOfWork <ISingleSignOnToken>(snapshotRepository);

            _aggregate = session.Get <TestSnapshotAggregate>(Guid.NewGuid());
        }
Beispiel #9
0
        public GetSnapshotableAggregateTest()
        {
            var eventStore = new TestInMemoryEventStore();

            _snapshotStore = new TestSnapshotStore();
            var snapshotStrategy   = new DefaultSnapshotStrategy(_snapshotStore);
            var repository         = new SnapshotRepository(_snapshotStore, snapshotStrategy, new Repository(eventStore), eventStore);
            var eventStoreSettings = new TestEventStoreSettings {
                SessionLockEnabled = false
            };
            var session = new Session(repository, eventStoreSettings, null);

            _aggregate = session.GetAsync <TestSnapshotAggregate>(Guid.NewGuid().ToString()).Result;
        }
        public void Setup()
        {
            var eventStore     = new TestEventStore();
            var eventPublisher = new TestEventPublisher();

            _snapshotStore = new TestSnapshotStore();
            var rep       = new Repository <TestSnapshotAggreagate>(eventStore, _snapshotStore, eventPublisher);
            var aggregate = new TestSnapshotAggreagate();

            for (int i = 0; i < 30; i++)
            {
                aggregate.DoSomething();
            }
            rep.Save(aggregate, 0);
        }
Beispiel #11
0
        public void Setup()
        {
            var eventStore = new TestInMemoryEventStore();

            _snapshotStore = new TestSnapshotStore();
            var snapshotStrategy = new DefaultSnapshotStrategy();
            var repository       = new SnapshotRepository(_snapshotStore, snapshotStrategy, new Repository(eventStore), eventStore);
            var session          = new Session(repository);
            var aggregate        = new TestSnapshotAggregate();

            for (var i = 0; i < 200; i++)
            {
                aggregate.DoSomething();
            }
            session.Add(aggregate);
            session.Commit();
        }
        public void Setup()
        {
            var eventStore     = new TestInMemoryEventStore();
            var eventPublisher = new TestEventPublisher();

            _snapshotStore = new TestSnapshotStore();
            var snapshotStrategy = new DefaultSnapshotStrategy <ISingleSignOnToken>();
            var aggregateFactory = new AggregateFactory(null);
            var repository       = new SnapshotRepository <ISingleSignOnToken>(_snapshotStore, snapshotStrategy, new Repository <ISingleSignOnToken>(aggregateFactory, eventStore, eventPublisher, new NullCorrelationIdHelper()), eventStore, aggregateFactory);
            var session          = new UnitOfWork <ISingleSignOnToken>(repository);
            var aggregate        = new TestSnapshotAggregate();

            for (int i = 0; i < 30; i++)
            {
                aggregate.DoSomething();
            }
            session.Add(aggregate);
            session.Commit();
        }
        public SaveNotSnapshotableAggregate()
        {
            _eventStore    = new TestInMemoryEventStore();
            _snapshotStore = new TestSnapshotStore();
            var snapshotStrategy = new DefaultSnapshotStrategy(_snapshotStore);
            var repository       = new SnapshotRepository(_snapshotStore, snapshotStrategy, new Repository(_eventStore), _eventStore);
            var session          = new Session(repository);
            var aggregate        = new TestAggregate(Guid.NewGuid().ToString());

            for (var i = 0; i < 200; i++)
            {
                aggregate.DoSomething();
            }
            Task.Run(async() =>
            {
                session.Add(aggregate);
                await session.CommitAsync();
            }).Wait();
        }
        public When_saving_a_snapshotable_aggregate()
        {
            var eventStore = new TestInMemoryEventStore();

            _snapshotStore = new TestSnapshotStore();
            var snapshotStrategy = new DefaultSnapshotStrategy();
            var repository       = new SnapshotRepository(_snapshotStore, snapshotStrategy, new Repository(eventStore), eventStore);
            var session          = new Session(repository);
            var aggregate        = new TestSnapshotAggregate();

            for (var i = 0; i < 200; i++)
            {
                aggregate.DoSomething();
            }
            Task.Run(async() =>
            {
                await session.Add(aggregate);
                await session.Commit();
            }).Wait();
        }
Beispiel #15
0
        public When_saving_a_not_snapshotable_aggregate()
        {
            _eventStore    = new TestInMemoryEventStore();
            _snapshotStore = new TestSnapshotStore();
            var snapshotStrategy = new DefaultSnapshotStrategy();
            var repository       = new SnapshotRepository(_snapshotStore, snapshotStrategy, new Repository(_eventStore), _eventStore);
            var session          = new Session(repository);
            var aggregate        = new TestAggregate(Guid.NewGuid());

            _token = new CancellationToken();

            for (var i = 0; i < 200; i++)
            {
                aggregate.DoSomething();
            }
            Task.Run(async() =>
            {
                await session.Add(aggregate, _token);
                await session.Commit(_token);
            }).Wait();
        }
Beispiel #16
0
        public WhenSavingASnapshotableAggregate()
        {
            var eventStore = new TestInMemoryEventStore();

            _snapshotStore = new TestSnapshotStore();
            var snapshotStrategy = new DefaultSnapshotStrategy(_snapshotStore);
            var repository       = new SnapshotRepository(_snapshotStore, snapshotStrategy, new Repository(eventStore),
                                                          eventStore);
            var eventStoreSettings = new TestEventStoreSettings {
                SessionLockEnabled = false
            };
            var session   = new Session(repository, eventStoreSettings, null);
            var aggregate = new TestSnapshotAggregate();

            for (var i = 0; i < 200; i++)
            {
                aggregate.DoSomething();
            }
            Task.Run(async() =>
            {
                session.Add(aggregate);
                await session.CommitAsync();
            }).Wait();
        }