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

          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_a_snapshot_aggregate_with_no_snapshot
      14           0 :         {
      15             :                 private TestSnapshotAggregate _aggregate;
      16             : 
      17             :                 private TestDependencyResolver _dependencyResolver;
      18             : 
      19             :                 [SetUp]
      20           0 :                 public void Setup()
      21             :                 {
      22             :                         var eventStore = new TestSnapshotEventStore();
      23             :                         var eventPublisher = new TestEventPublisher();
      24             :                         var snapshotStore = new NullSnapshotStore();
      25             :                         var snapshotStrategy = new DefaultSnapshotStrategy<ISingleSignOnToken>();
      26             :                         _dependencyResolver = new TestDependencyResolver(null);
      27             :                         var aggregateFactory = new AggregateFactory(_dependencyResolver, _dependencyResolver.Resolve<ILogger>());
      28             :                         var repository = new SnapshotRepository<ISingleSignOnToken>(snapshotStore, snapshotStrategy, new AggregateRepository<ISingleSignOnToken>(aggregateFactory, eventStore, eventPublisher, new NullCorrelationIdHelper()), eventStore, aggregateFactory);
      29             :                         var session = new UnitOfWork<ISingleSignOnToken>(repository);
      30             :                         Guid id = Guid.NewGuid();
      31             :                         _dependencyResolver.NewAggregateGuid = id;
      32             :                         _aggregate = session.Get<TestSnapshotAggregate>(id);
      33             :                 }
      34             : 
      35             :                 private class NullSnapshotStore : ISnapshotStore
      36             :                 {
      37           0 :                         public Snapshot Get(Guid id)
      38             :                         {
      39             :                                 return null;
      40             :                         }
      41             : 
      42           0 :                         public void Save(Snapshot snapshot)
      43             :                         {
      44             :                         }
      45             :                 }
      46             : 
      47             :                 [Test]
      48           0 :                 public void Should_load_events()
      49             :                 {
      50             :                         Assert.True(_aggregate.Loaded);
      51             :                 }
      52             : 
      53             :                 [Test]
      54           0 :                 public void Should_not_load_snapshot()
      55             :                 {
      56             :                         Assert.False(_aggregate.Restored);
      57             :                 }
      58             :         }
      59             : }

Generated by: LCOV version 1.10