public void CanProfileLazyRequests()
{
using (GetNewServer())
using (var store = new DocumentStore { Url = "http://localhost:8079" })
{
store.Initialize();
store.InitializeProfiling();
using (var session = store.OpenSession())
{
// handle the initial request for replication information
}
Guid id;
using (var session = store.OpenSession())
{
id = ((DocumentSession)session).DatabaseCommands.ProfilingInformation.Id;
session.Advanced.Lazily.Load<User>("users/1");
session.Advanced.Lazily.Load<User>("users/2");
session.Advanced.Lazily.Load<User>("users/3");
session.Advanced.Eagerly.ExecuteAllPendingLazyOperations();
}
var profilingInformation = store.GetProfilingInformationFor(id);
Assert.Equal(1, profilingInformation.Requests.Count);
var responses = JsonConvert.DeserializeObject<GetResponse[]>(profilingInformation.Requests[0].Result, Default.Converters);
Assert.Equal(3, responses.Length);
foreach (var response in responses)
{
Assert.Equal(404, response.Status);
}
}
}