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

          Line data    Source code
       1             : using System;
       2             : using Cqrs.Cache;
       3             : using Cqrs.Authentication;
       4             : using Cqrs.Tests.Substitutes;
       5             : using NUnit.Framework;
       6             : 
       7             : namespace Cqrs.Tests.Cache
       8             : {
       9             :         [TestFixture]
      10             :         public class When_saving_aggregate
      11           0 :         {
      12             :                 private CacheRepository<ISingleSignOnToken> _rep;
      13             :                 private TestAggregate _aggregate;
      14             :                 private TestAggregateRepository _testRep;
      15             : 
      16             :                 [SetUp]
      17           0 :                 public void Setup()
      18             :                 {
      19             :                         _testRep = new TestAggregateRepository();
      20             :                         _rep = new CacheRepository<ISingleSignOnToken>(_testRep, new TestInMemoryEventStore());
      21             :                         _aggregate = _testRep.Get<TestAggregate>(Guid.NewGuid());
      22             :                         _aggregate.DoSomething();
      23             :                         _rep.Save(_aggregate,-1);
      24             :                 }
      25             : 
      26             :                 [Test]
      27           0 :                 public void Should_get_same_aggregate_on_get()
      28             :                 {
      29             :                         var aggregate = _rep.Get<TestAggregate>(_aggregate.Id);
      30             :                         Assert.That(aggregate, Is.EqualTo(_aggregate));
      31             :                 }
      32             : 
      33             :                 [Test]
      34           0 :                 public void Should_save_to_repository()
      35             :                 {
      36             :                         Assert.That(_testRep.Saved, Is.EqualTo(_aggregate));
      37             :                 }
      38             : 
      39             :                 [Test]
      40           0 :                 public void Should_not_cache_empty_id()
      41             :                 {
      42             :                         var aggregate = new TestAggregate(Guid.Empty);
      43             :                         _rep.Save(aggregate);
      44             :                         Assert.That(_rep.Get<TestAggregate>(Guid.Empty), Is.Not.EqualTo(aggregate));
      45             :                 }
      46             :         }
      47             : }

Generated by: LCOV version 1.10