public static void WaitForUserToContinueTheTest(EmbeddableDocumentStore documentStore, bool debug = true) { if (debug && Debugger.IsAttached == false) return; documentStore.SetStudioConfigToAllowSingleDb(); documentStore.DatabaseCommands.Put("Pls Delete Me", null, RavenJObject.FromObject(new { StackTrace = new StackTrace(true) }), new RavenJObject()); documentStore.Configuration.AnonymousUserAccessMode = AnonymousUserAccessMode.Admin; using (var server = new HttpServer(documentStore.Configuration, documentStore.DocumentDatabase)) { server.StartListening(); Process.Start(documentStore.Configuration.ServerUrl); // start the server do { Thread.Sleep(100); } while (documentStore.DatabaseCommands.Get("Pls Delete Me") != null && (debug == false || Debugger.IsAttached)); } }
private static void Main() { // Initialize the database and create indexes var documentStore = new EmbeddableDocumentStore { UseEmbeddedHttpServer = true, #if DEBUG RunInMemory = true #endif }; _documentStore = documentStore; documentStore.SetStudioConfigToAllowSingleDb(); documentStore.Configuration.AnonymousUserAccessMode = AnonymousUserAccessMode.All; documentStore.Configuration.Settings.Add("Raven/ActiveBundles", "Expiration"); documentStore.Configuration.Settings.Add("Raven/Expiration/DeleteFrequencySeconds", "10"); documentStore.Initialize(); IndexCreation.CreateIndexes(typeof(Program).Assembly, documentStore); // Set up some pressure gauge simulators at different starting points and speeds AddPressureGauge("Pressure Gague 1", 30, 10); AddPressureGauge("Pressure Gague 2", 50, 20); AddPressureGauge("Pressure Gague 3", 70, 30); // Set up the polling timer to read the gauges periodically PollingTimer.Interval = TakeReadingsEvery.TotalMilliseconds; PollingTimer.Elapsed += PollingTimerElapsed; PollingTimer.Start(); while (DoMenu()) { } PollingTimer.Stop(); PollingTimer.Dispose(); foreach (var sensor in Sensors.Values) sensor.Dispose(); documentStore.DocumentDatabase.StopBackgroundWorkers(); documentStore.Dispose(); }