Documentation Coverage Report
Current view: top level - Ninject/Azure/Cqrs.Ninject.Azure.DocumentDb/Events - TestAzureDocumentDbEventStoreConnectionStringFactory.cs Hit Total Coverage
Version: 2.2 Artefacts: 3 3 100.0 %
Date: 2017-09-22

          Line data    Source code
       1             : #region Copyright
       2             : // // -----------------------------------------------------------------------
       3             : // // <copyright company="Chinchilla Software Limited">
       4             : // //   Copyright Chinchilla Software Limited. All rights reserved.
       5             : // // </copyright>
       6             : // // -----------------------------------------------------------------------
       7             : #endregion
       8             : 
       9             : using Cqrs.Azure.DocumentDb.Events;
      10             : using cdmdotnet.Logging;
      11             : using cdmdotnet.StateManagement;
      12             : using cdmdotnet.StateManagement.Threaded;
      13             : using Cqrs.Configuration;
      14             : using Cqrs.DataStores;
      15             : using Cqrs.Events;
      16             : 
      17             : namespace Cqrs.Ninject.Azure.DocumentDb.Events
      18             : {
      19             :         /// <summary>
      20             :         /// A <see cref="AzureDocumentDbEventStoreConnectionStringFactory"/>
      21             :         /// that enables you to set a database name with <see cref="DatabaseName"/>. This means you can randomly generate your own database name per test.
      22             :         /// </summary>
      23             :         public class TestAzureDocumentDbEventStoreConnectionStringFactory : AzureDocumentDbEventStoreConnectionStringFactory
      24           1 :         {
      25             :                 private const string CallContextDatabaseNameKey = "AzureDocumentDbEventStoreConnectionStringFactory¿DatabaseName";
      26             : 
      27             :                 private static IContextItemCollection Query { get; set; }
      28             : 
      29             :                 static TestAzureDocumentDbEventStoreConnectionStringFactory()
      30             :                 {
      31             :                         Query = new ThreadedContextItemCollection();
      32             :                 }
      33             : 
      34             :                 /// <summary>
      35             :                 /// The name of the database currently being used.
      36             :                 /// </summary>
      37             :                 public static string DatabaseName
      38             :                 {
      39             :                         get
      40             :                         {
      41             :                                 return Query.GetData<string>(CallContextDatabaseNameKey);
      42             :                         }
      43             :                         set
      44             :                         {
      45             :                                 Query.SetData(CallContextDatabaseNameKey, value);
      46             :                         }
      47             :                 }
      48             : 
      49             :                 /// <summary>
      50             :                 /// Instantiates a new instance of <see cref="TestAzureDocumentDbEventStoreConnectionStringFactory"/> defaulting to using <see cref="ConfigurationManager"/>
      51             :                 /// </summary>
      52           1 :                 public TestAzureDocumentDbEventStoreConnectionStringFactory(ILogger logger)
      53             :                         : base(logger, new ConfigurationManager())
      54             :                 {
      55             :                 }
      56             : 
      57             :                 #region Implementation of IAzureDocumentDbDataStoreConnectionStringFactory
      58             : 
      59             :                 /// <summary>
      60             :                 /// Gets the value of <see cref="DatabaseName"/>.
      61             :                 /// </summary>
      62           1 :                 public override string GetEventStoreConnectionDatabaseName()
      63             :                 {
      64             :                         return DatabaseName;
      65             :                 }
      66             : 
      67             :                 #endregion
      68             :         }
      69             : }

Generated by: LCOV version 1.10