public When_saving_events_without_id() { _eventStore = new TestInMemoryEventStore(); _rep = new Repository(_eventStore); _aggregate = new TestAggregate(Guid.Empty); }
public void Setup() { _eventStore = new TestInMemoryEventStore(); _rep = new Repository(_eventStore); _aggregate = new TestAggregate(Guid.Empty); }
public When_saving_events_without_id() { var eventStore = new TestInMemoryEventStore(); _rep = new Repository(eventStore); _aggregate = new TestAggregate(default);
public SaveEventsWithoutIdTest() { _eventStore = new TestInMemoryEventStore(); _rep = new Repository(_eventStore); _aggregate = new TestAggregate(""); }
public void Setup() { var eventStore = new TestInMemoryEventStore(); var eventPublisher = new TestEventPublisher(); _session = new Session(new Repository(eventStore, eventPublisher)); }
public void SetUp() { var aggregateFactory = new AggregateFactory(null); var eventStore = new TestInMemoryEventStore(); var eventPublisher = new TestEventPublisher(); _unitOfWork = new UnitOfWork <ISingleSignOnToken>(new Repository <ISingleSignOnToken>(aggregateFactory, eventStore, eventPublisher, new NullCorrelationIdHelper())); }
public SaveTest() { _eventStore = new TestInMemoryEventStore(); _rep = new Repository(_eventStore); _session = new Session(_rep); _aggregate = new TestAggregateNoParameterLessConstructor(2); }
public When_saving_aggregate() { _testRep = new TestRepository(); _testEventStore = new TestInMemoryEventStore(); _rep = new CacheRepository(_testRep, _testEventStore, new MemoryCache()); _aggregate = _testRep.Get <TestAggregate>(Guid.NewGuid()).Result; _aggregate.DoSomething(); _rep.Save(_aggregate, -1).Wait(); }
public When_saving() { _eventStore = new TestInMemoryEventStore(); var rep = new Repository(_eventStore); _session = new Session(rep); _aggregate = new TestAggregateNoParameterLessConstructor(2); }
public void Setup() { _eventStore = new TestInMemoryEventStore(); _eventPublisher = new TestEventPublisher(); _rep = new Repository(_eventStore, _eventPublisher); _session = new Session(_rep); _aggregate = new TestAggregateNoParameterLessConstructor(2); }
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; }
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()); }
public void Setup() { _eventStore = new TestInMemoryEventStore(); _rep = new Repository(_eventStore); _session = new Session(_rep); _aggregate = new TestAggregate(Guid.NewGuid()); _aggregate.DoSomething(); _rep.Save(_aggregate); }
public When_saving_stale_data() { _eventStore = new TestInMemoryEventStore(); _rep = new Repository(_eventStore); _session = new Session(_rep); _aggregate = new TestAggregate(Guid.NewGuid()); _aggregate.DoSomething(); _rep.Save(_aggregate); }
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; }
public SaveStaleDataTest() { _eventStore = new TestInMemoryEventStore(); _rep = new Repository(_eventStore); _session = new Session(_rep); _aggregate = new TestAggregate(Guid.NewGuid().ToString()); _aggregate.DoSomething(); _rep.SaveAsync(_aggregate).Wait(); }
public void Setup() { _eventStore = new TestInMemoryEventStore(); _eventPublisher = new TestEventPublisher(); var aggregateFactory = new AggregateFactory(null); _rep = new Repository <ISingleSignOnToken>(aggregateFactory, _eventStore, _eventPublisher, new NullCorrelationIdHelper()); _aggregate = new TestAggregate(Guid.Empty); }
public void Setup() { // This will clear the cache between runs. var cacheKeys = MemoryCache.Default.Select(kvp => kvp.Key).ToList(); foreach (var cacheKey in cacheKeys) { MemoryCache.Default.Remove(cacheKey); } var dependencyResolver = new TestDependencyResolver(null); var aggregateFactory = new AggregateFactory(dependencyResolver, dependencyResolver.Resolve <ILogger>()); _testStore = new TestInMemoryEventStore(); _rep1 = new CacheRepository <ISingleSignOnToken>(new AggregateRepository <ISingleSignOnToken>(aggregateFactory, _testStore, new TestEventPublisher(), new NullCorrelationIdHelper()), _testStore); _rep2 = new CacheRepository <ISingleSignOnToken>(new AggregateRepository <ISingleSignOnToken>(aggregateFactory, _testStore, new TestEventPublisher(), new NullCorrelationIdHelper()), _testStore); _aggregate = new TestAggregate(Guid.NewGuid()); _rep1.Save(_aggregate); var t1 = new Task(() => { for (var i = 0; i < 100; i++) { var aggregate = _rep1.Get <TestAggregate>(_aggregate.Id); aggregate.DoSomething(); _rep1.Save(aggregate); } }); var t2 = new Task(() => { for (var i = 0; i < 100; i++) { var aggregate = _rep2.Get <TestAggregate>(_aggregate.Id); aggregate.DoSomething(); _rep2.Save(aggregate); } }); var t3 = new Task(() => { for (var i = 0; i < 100; i++) { var aggregate = _rep2.Get <TestAggregate>(_aggregate.Id); aggregate.DoSomething(); _rep2.Save(aggregate); } }); t1.Start(); t2.Start(); t3.Start(); Task.WaitAll(new[] { t1, t2, t3 }); }
public GetAggregateWithoutConstructor() { _id = Guid.NewGuid().ToString(); var eventStore = new TestInMemoryEventStore(); _repository = new Repository(eventStore); var aggreagate = new TestAggregateNoParameterLessConstructor(1, _id); aggreagate.DoSomething(); _repository.SaveAsync(aggreagate).Wait(); }
public SaveWithLockTest() { _eventStore = new TestInMemoryEventStore(); _rep = new Repository(_eventStore); _eventStoreSettings = new TestEventStoreSettings { SessionLockEnabled = true }; _distributedLockFactory = A.Fake <IDistributedLockFactory>(); _session = new Session(_rep, _eventStoreSettings, _distributedLockFactory); _aggregate = new TestAggregateNoParameterLessConstructor(2); }
public When_saving_events_with_wrong_id() { var eventStore = new TestInMemoryEventStore(); _rep = new Repository(eventStore); _aggregate = new TestAggregate(Guid.NewGuid()); _aggregate.ApplyChangeProxy(new TestAggregateDidSomething { Id = Guid.NewGuid() }); }
public When_saving_using_repository_with_event_publisher() { _eventStore = new TestInMemoryEventStore(); _eventPublisher = new TestEventPublisher(); #pragma warning disable 618 _rep = new Repository(_eventStore, _eventPublisher); #pragma warning restore 618 _session = new Session(_rep); _aggregate = new TestAggregateNoParameterLessConstructor(2); }
public void Setup() { _eventStore = new TestInMemoryEventStore(); _eventPublisher = new TestEventPublisher(); var dependencyResolver = new TestDependencyResolver(null); var aggregateFactory = new AggregateFactory(dependencyResolver, dependencyResolver.Resolve <ILogger>()); _rep = new AggregateRepository <ISingleSignOnToken>(aggregateFactory, _eventStore, _eventPublisher, new NullCorrelationIdHelper(), new ConfigurationManager()); _aggregate = new TestAggregate(Guid.Empty); }
public void Setup() { _id = Guid.NewGuid(); var eventStore = new TestInMemoryEventStore(); _repository = new Repository(eventStore); var aggreagate = new TestAggregateNoParameterLessConstructor(1, _id); aggreagate.DoSomething(); _repository.Save(aggreagate); }
public When_saving_stale_data() { _eventStore = new TestInMemoryEventStore(); _rep = new Repository(_eventStore); _session = new Session(_rep); _id = Guid.NewGuid(); _aggregate = new TestAggregate(_id); _aggregate.DoSomething(); Task.Run(async() => await _rep.Save(_aggregate)).Wait(); }
public When_getting_snapshotable_aggreate() { 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); _aggregate = session.Get <TestSnapshotAggregate>(Guid.NewGuid()); }
public When_getting_aggregate_without_contructor() { _id = Guid.NewGuid(); var eventStore = new TestInMemoryEventStore(); _repository = new Repository(eventStore); var aggreagate = new TestAggregateNoParameterLessConstructor(1, _id); aggreagate.DoSomething(); Task.Run(() => _repository.Save(aggreagate)).Wait(); }
public void Setup() { var aggregateFactory = new AggregateFactory(new TestDependencyResolver()); _eventStore = new TestInMemoryEventStore(); _eventPublisher = new TestEventPublisher(); _rep = new Repository <ISingleSignOnToken>(aggregateFactory, _eventStore, _eventPublisher, new NullCorrelationIdHelper()); _unitOfWork = new UnitOfWork <ISingleSignOnToken>(_rep); _aggregate = new TestAggregateNoParameterLessConstructor(2); }
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()); }