Esempio n. 1
0
        /// <summary>
        /// Constructs a <see cref="MongoTestServer" /> instance by starting a new process.
        /// </summary>
        /// <param name="port">The mongod.exe instance port number.</param>
        /// <param name="process"></param>
        /// <param name="fileSystem"></param>
        /// <param name="dataPath"></param>
        internal MongoTestServer(UInt16 port, IProcess process, IFileSystem fileSystem, string dataPath)
        {
            if (process == null)
            {
                throw new ArgumentNullException(nameof(process));
            }

            if (fileSystem == null)
            {
                throw new ArgumentNullException(nameof(fileSystem));
            }

            if (dataPath == null)
            {
                throw new ArgumentNullException(nameof(dataPath));
            }

            _process        = process;
            _fileSystem     = fileSystem;
            _dataPath       = dataPath;
            _randomDatabase = new DefaultRandomMongoDatabase(port);
            _mode           = MongoTestServerMode.WithOwnedProcess;
        }
Esempio n. 2
0
 /// <summary>
 /// Constructs a <see cref="MongoTestServer" /> instance without starting a new process.
 /// </summary>
 /// <param name="port">The mongod.exe instance port number.</param>
 internal MongoTestServer(UInt16 port)
 {
     _randomDatabase = new DefaultRandomMongoDatabase(port);
     _mode           = MongoTestServerMode.WithoutOwnedProcess;
 }