Source

mongo-dart / tests / DbCommandTest.dart

vadimtsushko 9f4d884 
vadimtsushko f35d109 
vadimtsushko 3bb9459 
vadimtsushko f35d109 
vadimtsushko e056253 
vadimtsushko f35d109 
vadimtsushko e056253 
vadimtsushko f35d109 

vadimtsushko e056253 
vadimtsushko b049363 

















vadimtsushko f35d109 



vadimtsushko 9f4d884 


vadimtsushko b049363 
vadimtsushko 9f4d884 
vadimtsushko f35d109 
#library("dbcommand");
#import("../lib/mongo.dart");
#import('../../../dart/dart-sdk/lib/unittest/unittest.dart');
testDbCommandCreation(){
  Db db = new Db('mongo-dart-test');
  DbCommand dbCommand = new DbCommand(db,"student",0,0,1,{},{});
  Expect.stringEquals('mongo-dart-test.student',dbCommand.collectionNameBson.value);
}
testPingDbCommand(){
  Db db = new Db('mongo-dart-test');
  db.open().then((d){
    DbCommand pingCommand = DbCommand.createPingCommand(db);
    Future<MongoReplyMessage> mapFuture = db.executeQueryMessage(pingCommand);
    mapFuture.then((msg) {
      Expect.mapEquals({'ok': 1},msg.documents[0]);
      db.close();
    });
  });
}
testDropDbCommand(){
  Db db = new Db('mongo-dart-test');
  db.open().then((d){
    DbCommand command = DbCommand.createDropDatabaseCommand(db);
    Future<MongoReplyMessage> mapFuture = db.executeQueryMessage(command);
    mapFuture.then((msg) {
      expect(msg.documents[0]["ok"]).equals(1);      
      db.close();  
    });
  });
}

main(){
  group("DBCommand tests:", (){
    test("testDbCommandCreation",testDbCommandCreation);
    test("testPingDbCommand",testPingDbCommand);
    test("testDropDbCommand",testDropDbCommand);    
  });
}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.