我使用RavenDB与RunInMemory = true
进行集成测试。我正在调试的问题之一与JSON序列化有关。查看内存中DocumentStore
的序列化JSON数据(作为字符串)的最简单方法是什么?
答案 0 :(得分:5)
你可以这样做:
static public void WaitForUserToContinueTheTest(
EmbeddableDocumentStore documentStore)
{
if (Debugger.IsAttached == false)
return;
documentStore.DatabaseCommands.Put("Pls Delete Me", null,
RavenJObject.FromObject(new {
StackTrace = new StackTrace(true)
}), new RavenJObject());
documentStore.Configuration.AnonymousUserAccessMode =
AnonymousUserAccessMode.All;
using (var server = new HttpServer(documentStore.Configuration,
documentStore.DocumentDatabase))
{
server.StartListening();
// start the server
Process.Start(documentStore.Configuration.ServerUrl);
do
{
Thread.Sleep(100);
} while (
documentStore.DatabaseCommands.Get("Pls Delete Me") != null &&
Debugger.IsAttached);
}
}
这将为您打开服务器,并让您看到RavenDB中发生的所有事情。