@@ -27,7 +27,6 @@ public class MongoServerTests
27
27
private MongoServer _server ;
28
28
private MongoDatabase _database ;
29
29
private MongoCollection < BsonDocument > _collection ;
30
- private bool _isMasterSlavePair ;
31
30
private bool _isReplicaSet ;
32
31
33
32
[ TestFixtureSetUp ]
@@ -37,11 +36,6 @@ public void Setup()
37
36
_database = Configuration . TestDatabase ;
38
37
_collection = Configuration . TestCollection ;
39
38
_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" ) ;
45
39
}
46
40
47
41
[ Test ]
@@ -100,28 +94,28 @@ public void TestCreateNoArgs()
100
94
[ Test ]
101
95
public void TestDatabaseExists ( )
102
96
{
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 ) ) ;
110
103
}
111
104
112
105
[ Test ]
106
+ [ RequiresServer ( ServerTypes = ServerTypes . Standalone ) ]
113
107
public void TestDropDatabase ( )
114
108
{
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 ) ) ;
120
115
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 ) ) ;
125
119
}
126
120
127
121
[ Test ]
0 commit comments