LCOV - code coverage report
Current view: top level - Azure/Cqrs.Azure.DocumentDb/Factories - AzureDocumentDbDataStoreConnectionStringFactory.cs Hit Total Coverage
Test: doc-coverage.info Lines: 0 8 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.Factories
       7             : {
       8             :         public class AzureDocumentDbDataStoreConnectionStringFactory : IAzureDocumentDbDataStoreConnectionStringFactory
       9           0 :         {
      10             :                 protected ILogger Logger { get; private set; }
      11             : 
      12             :                 protected IConfigurationManager ConfigurationManager { get; private set; }
      13             : 
      14           0 :                 public AzureDocumentDbDataStoreConnectionStringFactory(ILogger logger, IConfigurationManager configurationManager)
      15             :                 {
      16             :                         Logger = logger;
      17             :                         ConfigurationManager = configurationManager;
      18             :                 }
      19             : 
      20           0 :                 public virtual DocumentClient GetAzureDocumentDbConnectionClient()
      21             :                 {
      22             :                         Logger.LogDebug("Getting Azure document client", "AzureDocumentDbDataStoreConnectionStringFactory\\GetAzureDocumentDbConnectionClient");
      23             :                         try
      24             :                         {
      25             :                                 return new DocumentClient(GetAzureDocumentDbConnectionUrl(), GetAzureDocumentDbAuthorisationKey());
      26             :                         }
      27             :                         finally
      28             :                         {
      29             :                                 Logger.LogDebug("Getting Azure document client... Done", "AzureDocumentDbDataStoreConnectionStringFactory\\GetAzureDocumentDbConnectionClient");
      30             :                         }
      31             :                 }
      32             : 
      33           0 :                 public virtual string GetAzureDocumentDbDatabaseName()
      34             :                 {
      35             :                         return ConfigurationManager.GetSetting("Cqrs.Azure.DocumentDb.DatabaseName") ?? "CqrsStore";
      36             :                 }
      37             : 
      38           0 :                 public virtual string GetAzureDocumentDbCollectionName()
      39             :                 {
      40             :                         return ConfigurationManager.GetSetting("Cqrs.Azure.DocumentDb.CollectionName") ?? "CqrsDataStore";
      41             :                 }
      42             : 
      43           0 :                 public virtual bool UseOneCollectionPerDataStore()
      44             :                 {
      45             :                         bool value;
      46             :                         if (!bool.TryParse(ConfigurationManager.GetSetting("Cqrs.Azure.DocumentDb.UseOneCollectionPerDataStore"), out value))
      47             :                                 value = true;
      48             :                         return value;
      49             :                 }
      50             : 
      51           0 :                 protected virtual Uri GetAzureDocumentDbConnectionUrl()
      52             :                 {
      53             :                         return new Uri(ConfigurationManager.GetSetting("Cqrs.Azure.DocumentDb.Url"));
      54             :                 }
      55             : 
      56           0 :                 protected virtual string GetAzureDocumentDbAuthorisationKey()
      57             :                 {
      58             :                         return ConfigurationManager.GetSetting("Cqrs.Azure.DocumentDb.AuthorisationKey");
      59             :                 }
      60             :         }
      61             : }

Generated by: LCOV version 1.10