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

          Line data    Source code
       1             : using System;
       2             : using System.Text;
       3             : using Newtonsoft.Json;
       4             : 
       5             : namespace Cqrs.EventStore.Bus
       6             : {
       7             :         public class EventConverter
       8           0 :         {
       9           0 :                 public static TEvent GetEventFromData<TEvent>(byte[] eventData, string typeName)
      10             :                 {
      11             :                         var eventType = Type.GetType(typeName);
      12             : 
      13             :                         if (eventType == null)
      14             :                         {
      15             :                                 return default(TEvent);
      16             :                         }
      17             : 
      18             :                         string eventjson = Encoding.UTF8.GetString(eventData);
      19             :                         object eventObject = JsonConvert.DeserializeObject(eventjson, eventType);
      20             :                         return (TEvent)eventObject;
      21             :                 }
      22             :         }
      23             : }

Generated by: LCOV version 1.10