public async Task ShouldCreateAndResumeConnection() { var repository = EventStoreRepository.Create(new EventStoreRepositoryConfiguration()); await repository.Connect(TimeSpan.FromSeconds(10)); //wait for EventStore to setup user accounts await Task.Delay(500); var counter = 0; var subscription = repository.Observe("EUR/USD") .Subscribe(ev => { counter++; }); await repository.SavePendingEvents("EUR/USD", -1, new[] { new CcyPairChanged("Harmony", "EUR/USD", true, 1.32, 1.34) }); await Task.Delay(200); await _embeddedEventStore.Dispose(); _embeddedEventStore = new EmbeddedEventStoreFixture(); await _embeddedEventStore.Initialize(); await Wait.Until(() => repository.IsConnected, TimeSpan.FromSeconds(5)); //wait for EventStore to setup user accounts await Task.Delay(500); await repository.SavePendingEvents("EUR/USD", -1, new[] { new CcyPairChanged("Harmony", "EUR/USD", true, 1.32, 1.34) }); await Task.Delay(200); Assert.AreEqual(2, counter); subscription.Dispose(); repository.Dispose(); }
public async Task SetupFixture() { _embeddedEventStore = new EmbeddedEventStoreFixture(); await _embeddedEventStore.Initialize(); await Task.Delay(5000); var userCredentials = new UserCredentials("admin", "changeit"); var connectionSettings = ConnectionSettings.Create().WithConnectionTimeoutOf(TimeSpan.FromSeconds(10)).SetDefaultUserCredentials(userCredentials); _connection = EventStoreConnection.Create(connectionSettings, new Uri(EventStoreRepositoryConfiguration.Default.ConnectionString)); await _connection.ConnectAsync(); await Task.Delay(200); await CreateSubscription(_connection, euroDolStream, euroDolStream); await Task.Delay(200); await CreateSubscription(_connection, euroJpyStream, euroJpyStream); }
public async Task SetupFixture() { _embeddedEventStore = new EmbeddedEventStoreFixture(); await _embeddedEventStore.Initialize(); }