public async Task DropDatabaseAsync_should_invoke_the_correct_operation()
        {
            var operationExecutor = new MockOperationExecutor();
            var client = new MongoClient(operationExecutor);
            await client.DropDatabaseAsync("awesome");

            var call = operationExecutor.GetWriteCall<BsonDocument>();

            call.Operation.Should().BeOfType<DropDatabaseOperation>();
            ((DropDatabaseOperation)call.Operation).DatabaseNamespace.Should().Be(new DatabaseNamespace("awesome"));
        }
        public void DropDatabase_should_invoke_the_correct_operation(
            [Values(false, true)] bool async)
        {
            var operationExecutor = new MockOperationExecutor();
            var client = new MongoClient(operationExecutor);

            if (async)
            {
                client.DropDatabaseAsync("awesome").GetAwaiter().GetResult();
            }
            else
            {
                client.DropDatabase("awesome");
            }

            var call = operationExecutor.GetWriteCall<BsonDocument>();

            call.Operation.Should().BeOfType<DropDatabaseOperation>();
            ((DropDatabaseOperation)call.Operation).DatabaseNamespace.Should().Be(new DatabaseNamespace("awesome"));
        }
        public void DropDatabase_should_invoke_the_correct_operation(
            [Values(false, true)] bool async)
        {
            var operationExecutor = new MockOperationExecutor();
            var writeConcern = new WriteConcern(1);
            var client = new MongoClient(operationExecutor, new MongoClientSettings()).WithWriteConcern(writeConcern);

            if (async)
            {
                client.DropDatabaseAsync("awesome").GetAwaiter().GetResult();
            }
            else
            {
                client.DropDatabase("awesome");
            }

            var call = operationExecutor.GetWriteCall<BsonDocument>();

            var dropDatabaseOperation = call.Operation.Should().BeOfType<DropDatabaseOperation>().Subject;
            dropDatabaseOperation.DatabaseNamespace.Should().Be(new DatabaseNamespace("awesome"));
            dropDatabaseOperation.WriteConcern.Should().BeSameAs(writeConcern);
        }
Esempio n. 4
0
 public static void DropDatabase()
 {
     var client = new MongoClient(ConnectionString);
     client.DropDatabaseAsync(DatabaseName).Wait();
 }
Esempio n. 5
0
 public static void Clean()
 {
     var client = new MongoClient();
      client.DropDatabaseAsync(settings.DatabaseName);
 }
 public void TestCleanup()
 {
     var mongoClient = new MongoClient();
     mongoClient.DropDatabaseAsync(DatabaseName).Wait();
 }
Esempio n. 7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="client"></param>
 /// <param name="databaseName"></param>
 public virtual void DropDatabase(MongoDB.Driver.MongoClient client, string databaseName)
 {
     client.DropDatabaseAsync(databaseName);
 }
 protected static void DropDatabase()
 {
     var mongoClient = new MongoClient();
     mongoClient.DropDatabaseAsync(DatabaseName).Wait();
 }