@@ -27,7 +27,6 @@ public class MongoServerTests
2727 private MongoServer _server ;
2828 private MongoDatabase _database ;
2929 private MongoCollection < BsonDocument > _collection ;
30- private bool _isMasterSlavePair ;
3130 private bool _isReplicaSet ;
3231
3332 [ TestFixtureSetUp ]
@@ -37,11 +36,6 @@ public void Setup()
3736 _database = Configuration . TestDatabase ;
3837 _collection = Configuration . TestCollection ;
3938 _isReplicaSet = Configuration . TestServerIsReplicaSet ;
40-
41- var adminDatabase = _server . GetDatabase ( "admin" ) ;
42- var commandResult = adminDatabase . RunCommand ( "getCmdLineOpts" ) ;
43- var argv = commandResult . Response [ "argv" ] . AsBsonArray ;
44- _isMasterSlavePair = argv . Contains ( "--master" ) || argv . Contains ( "--slave" ) ;
4539 }
4640
4741 [ Test ]
@@ -100,28 +94,28 @@ public void TestCreateNoArgs()
10094 [ Test ]
10195 public void TestDatabaseExists ( )
10296 {
103- if ( ! _isMasterSlavePair )
104- {
105- _database . Drop ( ) ;
106- Assert . IsFalse ( _server . DatabaseExists ( _database . Name ) ) ;
107- _collection . Insert ( new BsonDocument ( "x" , 1 ) ) ;
108- Assert . IsTrue ( _server . DatabaseExists ( _database . Name ) ) ;
109- }
97+ var databaseName = Configuration . TestDatabase . Name + "-TestDatabaseExists" ;
98+ var database = _server . GetDatabase ( databaseName ) ;
99+ var collection = database . GetCollection ( "TestDatabaseExists" ) ;
100+ Assert . IsFalse ( _server . DatabaseExists ( databaseName ) ) ;
101+ collection . Insert ( new BsonDocument ( "x" , 1 ) ) ;
102+ Assert . IsTrue ( _server . DatabaseExists ( databaseName ) ) ;
110103 }
111104
112105 [ Test ]
106+ [ RequiresServer ( ServerTypes = ServerTypes . Standalone ) ]
113107 public void TestDropDatabase ( )
114108 {
115- if ( ! _isMasterSlavePair )
116- {
117- _collection . Insert ( new BsonDocument ( ) ) ;
118- var databaseNames = _server . GetDatabaseNames ( ) ;
119- Assert . IsTrue ( databaseNames . Contains ( _database . Name ) ) ;
109+ var databaseName = Configuration . TestDatabase . Name + "-TestDropDatabase" ;
110+ var database = _server . GetDatabase ( databaseName ) ;
111+ var collection = database . GetCollection ( "TestDropDatabase" ) ;
112+ collection . Insert ( new BsonDocument ( ) ) ;
113+ var databaseNames = _server . GetDatabaseNames ( ) ;
114+ Assert . IsTrue ( databaseNames . Contains ( databaseName ) ) ;
120115
121- var result = _server . DropDatabase ( _database . Name ) ;
122- databaseNames = _server . GetDatabaseNames ( ) ;
123- Assert . IsFalse ( databaseNames . Contains ( _database . Name ) ) ;
124- }
116+ var result = _server . DropDatabase ( databaseName ) ;
117+ databaseNames = _server . GetDatabaseNames ( ) ;
118+ Assert . IsFalse ( databaseNames . Contains ( databaseName ) ) ;
125119 }
126120
127121 [ Test ]
0 commit comments