LCOV - code coverage report
Current view: top level - Cqrs/Bus - FileBasedLastEventProcessedStore.cs Hit Total Coverage
Test: doc-coverage.info Lines: 0 2 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.IO;
      11             : using Cqrs.Configuration;
      12             : 
      13             : namespace Cqrs.Bus
      14             : {
      15             :         public class FileBasedLastEventProcessedStore : IStoreLastEventProcessed
      16           0 :         {
      17             :                 public const string AppSettingsKey = "FileBasedLastEventProcessed.Location";
      18             : 
      19             :                 public const string AppSettingsDefaultValue = @"%EVENTSTORE_HOME%\LastEventProcessedLocation";
      20             : 
      21             :                 protected string FileName { get; private set; }
      22             : 
      23           0 :                 public FileBasedLastEventProcessedStore(IConfigurationManager configurationManager)
      24             :                 {
      25             :                         string location = configurationManager.GetSetting(AppSettingsKey);
      26             :                         if (string.IsNullOrEmpty(location))
      27             :                         {
      28             :                                 location = AppSettingsDefaultValue;
      29             :                         }
      30             : 
      31             :                         FileName = Environment.ExpandEnvironmentVariables(location);
      32             :                 }
      33             : 
      34             :                 public string EventLocation
      35             :                 {
      36             :                         get
      37             :                         {
      38             :                                 return File.Exists(FileName) ? File.ReadAllText(FileName) : string.Empty;
      39             :                         }
      40             : 
      41             :                         set
      42             :                         {
      43             :                                 File.WriteAllText(FileName, value);
      44             :                         }
      45             :                 }
      46             :         }
      47             : }

Generated by: LCOV version 1.10