LCOV - code coverage report
Current view: top level - Cqrs/Events - EventDeserialiser.cs Hit Total Coverage
Test: doc-coverage.info Lines: 0 3 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 Newtonsoft.Json;
      11             : 
      12             : namespace Cqrs.Events
      13             : {
      14             :         public class EventDeserialiser<TAuthenticationToken> : IEventDeserialiser<TAuthenticationToken>
      15           0 :         {
      16             :                 public static JsonSerializerSettings DefaultSettings { get; private set; }
      17             : 
      18             :                 static EventDeserialiser()
      19             :                 {
      20             :                         DefaultSettings = DefaultJsonSerializerSettings.DefaultSettings;
      21             :                 }
      22             : 
      23           0 :                 public virtual IEvent<TAuthenticationToken> Deserialise(EventData eventData)
      24             :                 {
      25             :                         JsonSerializerSettings jsonSerialiserSettings = GetSerialisationSettings();
      26             : 
      27             :                         return (IEvent<TAuthenticationToken>)JsonConvert.DeserializeObject((string)eventData.Data, Type.GetType(eventData.EventType), jsonSerialiserSettings);
      28             :                 }
      29             : 
      30           0 :                 protected virtual JsonSerializerSettings GetSerialisationSettings()
      31             :                 {
      32             :                         return DefaultSettings;
      33             :                 }
      34             :         }
      35             : }

Generated by: LCOV version 1.10