Documentation Coverage Report
Current view: top level - Akka.Net/Cqrs.Akka.Tests.Unit/Aggregates - HelloWorld.cs Hit Total Coverage
Version: 2.2 Artefacts: 8 8 100.0 %
Date: 2017-09-22

          Line data    Source code
       1             : #region Copyright
       2             : // // -----------------------------------------------------------------------
       3             : // // <copyright company="Chinchilla Software Limited">
       4             : // //   Copyright Chinchilla Software Limited. All rights reserved.
       5             : // // </copyright>
       6             : // // -----------------------------------------------------------------------
       7             : #endregion
       8             : 
       9             : using System;
      10             : using cdmdotnet.Logging;
      11             : using Cqrs.Akka.Domain;
      12             : using Cqrs.Akka.Tests.Unit.Commands;
      13             : using Cqrs.Akka.Tests.Unit.Events;
      14             : using Cqrs.Authentication;
      15             : using Cqrs.Configuration;
      16             : using Cqrs.Domain;
      17             : 
      18             : namespace Cqrs.Akka.Tests.Unit.Aggregates
      19             : {
      20             :         /// <summary>
      21             :         /// An Akka.Net actor based <see cref="IAggregateRoot{TAuthenticationToken}"/> that represents a conversation.
      22             :         /// </summary>
      23             :         public class HelloWorld : AkkaAggregateRoot<Guid>
      24           1 :         {
      25             :                 /// <summary>
      26             :                 /// The <see cref="IAggregateRoot{TAuthenticationToken}.Id"/>.
      27             :                 /// </summary>
      28             :                 public Guid Rsn
      29             :                 {
      30             :                         get { return Id; }
      31             :                         private set { Id = value; }
      32             :                 }
      33             : 
      34             :                 /// <summary>
      35             :                 /// Indicates if this <see cref="ISaga{TAuthenticationToken}"/> has been deleted.
      36             :                 /// </summary>
      37             :                 public bool IsLogicallyDeleted { get; set; }
      38             : 
      39             :                 /// <summary>
      40             :                 /// The <see cref="IDependencyResolver"/> that resolves things.
      41             :                 /// </summary>
      42             :                 protected IDependencyResolver DependencyResolver { get; private set; }
      43             : 
      44             : // ReSharper disable UnusedMember.Local
      45             :                 /// <summary>
      46             :                 /// A constructor for the <see cref="Cqrs.Domain.Factories.IAggregateFactory"/>
      47             :                 /// </summary>
      48             :                 private HelloWorld()
      49             :                         : base(null, null, null, null, null)
      50             :                 {
      51             :                         Receive<SayHelloWorldCommand>(command => Execute(SayHello, command));
      52             :                         Receive<ReplyToHelloWorldCommand>(command => Execute(ReplyToHelloWorld, command));
      53             :                         Receive<EndConversationCommand>(command => Execute(EndConversation, command));
      54             :                 }
      55             : 
      56             :                 /// <summary>
      57             :                 /// A constructor for the <see cref="Cqrs.Domain.Factories.IAggregateFactory"/>
      58             :                 /// </summary>
      59             :                 private HelloWorld(IDependencyResolver dependencyResolver, ILogger logger)
      60             :                         : this()
      61             :                 {
      62             :                         DependencyResolver = dependencyResolver;
      63             :                         Logger = logger;
      64             :                         UnitOfWork = DependencyResolver.Resolve<IUnitOfWork<Guid>>();
      65             :                         Repository = DependencyResolver.Resolve<IAkkaAggregateRepository<Guid>>();
      66             :                         CorrelationIdHelper = DependencyResolver.Resolve<ICorrelationIdHelper>();
      67             :                         AuthenticationTokenHelper = DependencyResolver.Resolve<IAuthenticationTokenHelper<Guid>>();
      68             :                 }
      69             : // ReSharper restore UnusedMember.Local
      70             : 
      71             :                 /// <summary>
      72             :                 /// Instantiates a new instance of <see cref="HelloWorld"/>.
      73             :                 /// </summary>
      74           1 :                 public HelloWorld(IDependencyResolver dependencyResolver, ILogger logger, Guid rsn)
      75             :                         : this(dependencyResolver, logger)
      76             :                 {
      77             :                         Rsn = rsn;
      78             :                 }
      79             : 
      80             :                 /// <summary>
      81             :                 /// Raises a <see cref="HelloWorldSaid"/>.
      82             :                 /// </summary>
      83           1 :                 public virtual void SayHello(SayHelloWorldCommand command)
      84             :                 {
      85             :                         SayHello();
      86             :                 }
      87             : 
      88             :                 /// <summary>
      89             :                 /// Raises a <see cref="HelloWorldRepliedTo"/>.
      90             :                 /// </summary>
      91           1 :                 public virtual void ReplyToHelloWorld(ReplyToHelloWorldCommand command)
      92             :                 {
      93             :                         ReplyToHelloWorld();
      94             :                 }
      95             : 
      96             :                 /// <summary>
      97             :                 /// Raises a <see cref="ConversationEnded"/>.
      98             :                 /// </summary>
      99           1 :                 public virtual void EndConversation(EndConversationCommand command)
     100             :                 {
     101             :                         EndConversation();
     102             :                 }
     103             : 
     104             :                 /// <summary>
     105             :                 /// Raises a <see cref="HelloWorldSaid"/>.
     106             :                 /// </summary>
     107           1 :                 public virtual void SayHello()
     108             :                 {
     109             :                         ApplyChange(new HelloWorldSaid { Id = Id });
     110             :                 }
     111             : 
     112             :                 /// <summary>
     113             :                 /// Raises a <see cref="HelloWorldRepliedTo"/>.
     114             :                 /// </summary>
     115           1 :                 public virtual void ReplyToHelloWorld()
     116             :                 {
     117             :                         ApplyChange(new HelloWorldRepliedTo { Id = Id });
     118             :                 }
     119             : 
     120             :                 /// <summary>
     121             :                 /// Raises a <see cref="ConversationEnded"/>.
     122             :                 /// </summary>
     123           1 :                 public virtual void EndConversation()
     124             :                 {
     125             :                         ApplyChange(new ConversationEnded { Id = Id });
     126             :                 }
     127             :         }
     128             : }

Generated by: LCOV version 1.10