Andrey Shchekin
Andrey Shchekin

Reputation: 21599

See raw JSON in RavenDB with RunInMemory

I have integration tests using RavenDB with RunInMemory = true. One of the issues I am debugging is related to JSON serialization. What is the easiest way to see serialized JSON data (as strings) for in-memory DocumentStore?

Upvotes: 2

Views: 320

Answers (1)

Ayende Rahien
Ayende Rahien

Reputation: 22956

You can do it like this:

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);
    }
}

This will opens the server for you, and will let you see everything that happens inside RavenDB.

Upvotes: 5

Related Questions