Exemplo n.º 1
0
 // private methods
 private IClientSessionHandle CreateSession(bool usingSession)
 {
     if (usingSession)
     {
         var client            = new Mock <IMongoClient>().Object;
         var options           = new ClientSessionOptions();
         var coreServerSession = new CoreServerSession();
         var coreSession       = new CoreSession(coreServerSession, options.ToCore());
         var coreSessionHandle = new CoreSessionHandle(coreSession);
         return(new ClientSessionHandle(client, options, coreSessionHandle));
     }
     else
     {
         return(null);
     }
 }
Exemplo n.º 2
0
 // private methods
 private IClientSessionHandle CreateSession(bool usingSession)
 {
     if (usingSession)
     {
         var client            = new Mock <IMongoClient>().Object;
         var options           = new ClientSessionOptions();
         var coreServerSession = new CoreServerSession();
         var serverSession     = new ServerSession(coreServerSession);
         var clientSession     = new ClientSession(client, options, serverSession, isImplicit: false);
         return(new ClientSessionHandle(clientSession));
     }
     else
     {
         return(null);
     }
 }