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

          Line data    Source code
       1             : using System;
       2             : using cdmdotnet.Logging;
       3             : using Cqrs.Configuration;
       4             : using Microsoft.Azure.Documents.Client;
       5             : 
       6             : namespace Cqrs.Azure.DocumentDb.Events
       7             : {
       8             :         public class AzureDocumentDbEventStoreConnectionStringFactory : IAzureDocumentDbEventStoreConnectionStringFactory
       9           0 :         {
      10             :                 protected ILogger Logger { get; private set; }
      11             : 
      12             :                 protected IConfigurationManager ConfigurationManager { get; private set; }
      13             : 
      14           0 :                 public AzureDocumentDbEventStoreConnectionStringFactory(ILogger logger, IConfigurationManager configurationManager)
      15             :                 {
      16             :                         Logger = logger;
      17             :                         ConfigurationManager = configurationManager;
      18             :                 }
      19             : 
      20           0 :                 public virtual DocumentClient GetEventStoreConnectionClient()
      21             :                 {
      22             :                         Logger.LogDebug("Getting Azure document client", "AzureDocumentDbEventStoreConnectionStringFactory\\GetEventStoreConnectionClient");
      23             :                         try
      24             :                         {
      25             :                                 return new DocumentClient(GetEventStoreConnectionUrl(), GetEventStoreConnectionAuthorisationKey());
      26             :                         }
      27             :                         finally
      28             :                         {
      29             :                                 Logger.LogDebug("Getting Azure document client... Done", "AzureDocumentDbEventStoreConnectionStringFactory\\GetEventStoreConnectionClient");
      30             :                         }
      31             :                 }
      32             : 
      33           0 :                 public virtual string GetEventStoreConnectionDatabaseName()
      34             :                 {
      35             :                         return ConfigurationManager.GetSetting("Cqrs.EventStore.Azure.DocumentDb.DatabaseName") ?? ConfigurationManager.GetSetting("Cqrs.EventStore.Azure.DocumentDb.LogStreamName") ?? "CqrsEventStore";
      36             :                 }
      37             : 
      38           0 :                 public string GetEventStoreConnectionCollectionName()
      39             :                 {
      40             :                         return ConfigurationManager.GetSetting("Cqrs.EventStore.Azure.DocumentDb.CollectionName") ?? "CqrsEventStore";
      41             :                 }
      42             : 
      43           0 :                 protected virtual Uri GetEventStoreConnectionUrl()
      44             :                 {
      45             :                         return new Uri(ConfigurationManager.GetSetting("Cqrs.EventStore.Azure.DocumentDb.Url"));
      46             :                 }
      47             : 
      48           0 :                 protected virtual string GetEventStoreConnectionAuthorisationKey()
      49             :                 {
      50             :                         return ConfigurationManager.GetSetting("Cqrs.EventStore.Azure.DocumentDb.AuthorisationKey");
      51             :                 }
      52             :         }
      53             : }

Generated by: LCOV version 1.10