/// <summary>
 /// Registers and initializes the given <paramref name="component"/> to recieve messages.
 /// Must call <see cref="Initialize"/> first.
 /// </summary>
 /// <param name="component">The <see cref="IRelayComponent"/> to register.</param>
 private void _registerComponent(IRelayComponent component)
 {
     if (_config == null)
     {
         throw new InvalidOperationException("Must call initialize first");
     }
     component.Initialize(_config, null);
     _components.Add(component);
 }
 /// <summary>
 /// Reloads the storage component.
 /// </summary>
 /// <param name="berkeleyDbConfig">The berkeley db config.</param>
 /// <param name="relayComponent">The relay component.</param>
 private static void ReloadStorageComponent(BerkeleyDbConfig berkeleyDbConfig, IRelayComponent relayComponent)
 {
     if (relayComponent is BerkeleyDbComponent)
     {
         (relayComponent as BerkeleyDbComponent).ReloadConfig(berkeleyDbConfig);
     }
     else
     {
         throw new Exception("Reload of CacheIndexStoreV3 Failed. Expected underlying storage to be a BDB component.");
     }
 }
 /// <summary>
 /// Reloads the storage component.
 /// </summary>
 /// <param name="berkeleyDbConfig">The berkeley db config.</param>
 /// <param name="relayComponent">The relay component.</param>
 private static void ReloadStorageComponent(BerkeleyDbConfig berkeleyDbConfig, IRelayComponent relayComponent)
 {
     if (relayComponent is BerkeleyDbComponent)
     {
         (relayComponent as BerkeleyDbComponent).ReloadConfig(berkeleyDbConfig);
     }
     else
     {
         throw new Exception("Reload of CacheIndexStoreV3 Failed. Expected underlying storage to be a BDB component.");
     }
 }
 public ComponentCleanup(ComponentTestManager manager, IRelayComponent component)
 {
     _component = component;
     _manager   = manager;
 }
 /// <summary>
 /// Registers the given <see cref="IRelayComponent"/>, and removes it upon disposing
 /// the returned <see cref="IDisposable"/> interface.
 /// </summary>
 /// <param name="component">The component to register.</param>
 /// <remarks>The removal is not thread safe, so all call must have completed before calling dispose.</remarks>
 /// <returns>The <see cref="IDisposable"/> interface that will remove the component on dispose.</returns>
 public IDisposable RegisterComponentScoped(IRelayComponent component)
 {
     _registerComponent(component);
     return(new ComponentCleanup(this, component));
 }