public void Establish() { _eventStoreNodeStarted = false; _eventStoreClientConnected = false; var noneIp = new IPEndPoint(IPAddress.None, 0); _eventStoreNode = EmbeddedVNodeBuilder .AsSingleNode() .RunInMemory() .WithExternalTcpOn(noneIp) .WithInternalTcpOn(noneIp) .WithExternalHttpOn(noneIp) .WithInternalHttpOn(noneIp) .Build(); _eventStoreNode.NodeStatusChanged += (sender, e) => { if (e.NewVNodeState == VNodeState.Master) { _eventStoreNodeStarted = true; } }; _eventStoreNode.Start(); _eventStore = EmbeddedEventStoreConnection.Create(_eventStoreNode); _eventStore.Connected += (sender, e) => { _eventStoreClientConnected = true; }; _eventStore.ConnectAsync().Wait(); _eventStoreMessageStore = new EventStoreMessageStore(_eventStore); _message1 = CreateMessage(0); _message2 = CreateMessage(1); EnsureEventStoreNodeHasStartedAndTheClientHasConnected(); AsyncContext.Run(async() => await _eventStoreMessageStore.AddAsync(_message1)); AsyncContext.Run(async() => await _eventStoreMessageStore.AddAsync(_message2)); }