Line data Source code
1 : using System;
2 : using cdmdotnet.Logging;
3 : using Cqrs.Domain;
4 : using Cqrs.Domain.Factories;
5 : using Cqrs.Authentication;
6 : using Cqrs.Snapshots;
7 : using Cqrs.Tests.Substitutes;
8 : using NUnit.Framework;
9 :
10 : namespace Cqrs.Tests.Snapshots
11 : {
12 : [TestFixture]
13 : public class When_getting_an_aggregate_with_snapshot
14 0 : {
15 : private TestSnapshotAggregate _aggregate;
16 :
17 : [SetUp]
18 0 : public void Setup()
19 : {
20 : var eventStore = new TestInMemoryEventStore();
21 : var eventPublisher = new TestEventPublisher();
22 : var snapshotStore = new TestSnapshotStore();
23 : var snapshotStrategy = new DefaultSnapshotStrategy<ISingleSignOnToken>();
24 : var dependencyResolver = new TestDependencyResolver(null);
25 : var aggregateFactory = new AggregateFactory(dependencyResolver, dependencyResolver.Resolve<ILogger>());
26 : var snapshotRepository = new SnapshotRepository<ISingleSignOnToken>(snapshotStore, snapshotStrategy, new Repository<ISingleSignOnToken>(aggregateFactory, eventStore, eventPublisher, new NullCorrelationIdHelper()), eventStore, aggregateFactory);
27 : var session = new UnitOfWork<ISingleSignOnToken>(snapshotRepository);
28 :
29 : _aggregate = session.Get<TestSnapshotAggregate>(Guid.NewGuid());
30 : }
31 :
32 : [Test]
33 0 : public void Should_restore()
34 : {
35 : Assert.True(_aggregate.Restored);
36 : }
37 : }
38 : }
|