LCOV - code coverage report
Current view: top level - Cqrs.Tests/Snapshots - When_saving_a_snapshotable_aggregate.cs Hit Total Coverage
Test: doc-coverage.info Lines: 0 4 0.0 %
Date: 2017-07-26

          Line data    Source code
       1             : using cdmdotnet.Logging;
       2             : using Cqrs.Domain;
       3             : using Cqrs.Domain.Factories;
       4             : using Cqrs.Authentication;
       5             : using Cqrs.Snapshots;
       6             : using Cqrs.Tests.Substitutes;
       7             : using NUnit.Framework;
       8             : 
       9             : namespace Cqrs.Tests.Snapshots
      10             : {
      11             :         [TestFixture]
      12             :         public class When_saving_a_snapshotable_aggregate
      13           0 :         {
      14             :                 private TestSnapshotStore _snapshotStore;
      15             : 
      16             :                 [SetUp]
      17           0 :                 public void Setup()
      18             :                 {
      19             :                         var eventStore = new TestInMemoryEventStore();
      20             :                         var eventPublisher = new TestEventPublisher();
      21             :                         _snapshotStore = new TestSnapshotStore();
      22             :                         var snapshotStrategy = new DefaultSnapshotStrategy<ISingleSignOnToken>();
      23             :                         var dependencyResolver = new TestDependencyResolver(null);
      24             :                         var aggregateFactory = new AggregateFactory(dependencyResolver, dependencyResolver.Resolve<ILogger>());
      25             :                         var repository = new SnapshotRepository<ISingleSignOnToken>(_snapshotStore, snapshotStrategy, new AggregateRepository<ISingleSignOnToken>(aggregateFactory, eventStore, eventPublisher, new NullCorrelationIdHelper()), eventStore, aggregateFactory);
      26             :                         var session = new UnitOfWork<ISingleSignOnToken>(repository);
      27             :                         var aggregate = new TestSnapshotAggregate();
      28             :                         for (int i = 0; i < 30; i++)
      29             :                         {
      30             :                                 aggregate.DoSomething();
      31             :                         }
      32             :                         session.Add(aggregate);
      33             :                         session.Commit();
      34             :                 }
      35             : 
      36             :                 [Test]
      37           0 :                 public void Should_save_snapshot()
      38             :                 {
      39             :                         Assert.True(_snapshotStore.VerifySave);
      40             :                 }
      41             : 
      42             :                 [Test]
      43           0 :                 public void Should_save_last_version_number()
      44             :                 {
      45             :                         Assert.AreEqual(30, _snapshotStore.SavedVersion);
      46             :                 }
      47             :         }
      48             : }

Generated by: LCOV version 1.10