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

          Line data    Source code
       1             : #region Copyright
       2             : // // -----------------------------------------------------------------------
       3             : // // <copyright company="cdmdotnet Limited">
       4             : // //   Copyright cdmdotnet Limited. All rights reserved.
       5             : // // </copyright>
       6             : // // -----------------------------------------------------------------------
       7             : #endregion
       8             : 
       9             : using System;
      10             : using System.Text;
      11             : 
      12             : namespace Cqrs.Events
      13             : {
      14             :         public abstract class EventBuilder<TAuthenticationToken> : IEventBuilder<TAuthenticationToken>
      15           0 :         {
      16             :                 #region Implementation of IEventBuilder
      17             : 
      18           0 :                 public virtual EventData CreateFrameworkEvent(string type, IEvent<TAuthenticationToken> eventData)
      19             :                 {
      20             :                         return new EventData
      21             :                         {
      22             :                                 EventId = Guid.NewGuid(),
      23             :                                 EventType = type,
      24             :                                 Data = SerialiseEventDataToString(eventData)
      25             :                         };
      26             :                 }
      27             : 
      28           0 :                 public virtual EventData CreateFrameworkEvent(IEvent<TAuthenticationToken> eventData)
      29             :                 {
      30             :                         return CreateFrameworkEvent(eventData.GetType().AssemblyQualifiedName, eventData);
      31             :                 }
      32             : 
      33             :                 #endregion
      34             : 
      35           0 :                 protected virtual byte[] SerialiseEventData(IEvent<TAuthenticationToken> eventData)
      36             :                 {
      37             :                         return new UTF8Encoding().GetBytes(SerialiseEventDataToString(eventData));
      38             :                 }
      39             : 
      40           0 :                 protected abstract string SerialiseEventDataToString(IEvent<TAuthenticationToken> eventData);
      41             :         }
      42             : }

Generated by: LCOV version 1.10