Ejemplo n.º 1
0
        /// <summary>
        /// Configures the data bus to store data in memory. This is probably only useful for test scenarios, as the
        /// passed-in <paramref name="inMemDataStore"/> needs to be shared among endpoints on the data bus.
        /// </summary>
        public static void StoreInMemory(this StandardConfigurer<IDataBusStorage> configurer, InMemDataStore inMemDataStore)
        {
            if (configurer == null) throw new ArgumentNullException(nameof(configurer));
            if (inMemDataStore == null) throw new ArgumentNullException(nameof(inMemDataStore));

            configurer.Register(c => new InMemDataBusStorage(inMemDataStore));
        }
Ejemplo n.º 2
0
 public InMemDataBusStorage(InMemDataStore dataStore)
 {
     if (dataStore == null)
     {
         throw new ArgumentNullException(nameof(dataStore));
     }
     _dataStore = dataStore;
 }
Ejemplo n.º 3
0
        protected override void SetUp()
        {
            _inMemNetwork = new InMemNetwork();
            _inMemDataStore = new InMemDataStore();

            _senderBus = StartBus("sender").Bus;
            _receiverActivator = StartBus("receiver");
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Establishes a fake presence of a configured data bus, using the given <see cref="InMemDataStore"/> to retrieve data
        /// </summary>
        public static IDisposable EstablishContext(InMemDataStore dataStore)
        {
            if (dataStore == null) throw new ArgumentNullException(nameof(dataStore));

            TestDataBusStorage = new InMemDataBusStorage(dataStore);

            return new CleanUp(() =>
            {
                TestDataBusStorage = null;
            });
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Creates the fake data bus, optionally using the given in-mem data store to store attachments
 /// </summary>
 /// <param name="dataStore"></param>
 public FakeDataBus(InMemDataStore dataStore = null)
 {
     // if a data store was passed in, we use that
     if (dataStore != null)
     {
         _dataBusStorage = new InMemDataBusStorage(dataStore);
     }
     // otherwise, if there is an "ambient" storage, use that
     else if (TestDataBusStorage != null)
     {
         _dataBusStorage = TestDataBusStorage;
     }
     // last resort: just fake it in mem
     else
     {
         _dataBusStorage = new InMemDataBusStorage(new InMemDataStore());
     }
 }
Ejemplo n.º 6
0
 public InMemDataBusStorage(InMemDataStore dataStore, IRebusTime rebusTime)
 {
     _dataStore = dataStore ?? throw new ArgumentNullException(nameof(dataStore));
     _rebusTime = rebusTime;
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Configures the data bus to store data in memory. This is probably only useful for test scenarios, as the
        /// passed-in <paramref name="inMemDataStore"/> needs to be shared among endpoints on the data bus.
        /// </summary>
        public static void StoreInMemory(this StandardConfigurer <IDataBusStorage> configurer, InMemDataStore inMemDataStore)
        {
            if (configurer == null)
            {
                throw new ArgumentNullException(nameof(configurer));
            }
            if (inMemDataStore == null)
            {
                throw new ArgumentNullException(nameof(inMemDataStore));
            }

            configurer.Register(c => new InMemDataBusStorage(inMemDataStore, c.Get <IRebusTime>()));
        }
Ejemplo n.º 8
0
 public InMemDataBusStorage(InMemDataStore dataStore)
 {
     _dataStore = dataStore;
 }
Ejemplo n.º 9
0
 public InMemDataBusStorage(InMemDataStore dataStore)
 {
     _dataStore = dataStore ?? throw new ArgumentNullException(nameof(dataStore));
 }
Ejemplo n.º 10
0
 public InMemDataBusStorage(InMemDataStore dataStore)
 {
     _dataStore = dataStore;
 }