本文整理汇总了C#中MongoDB.Driver.MongoClient.DropDatabaseAsync方法的典型用法代码示例。如果您正苦于以下问题:C# MongoClient.DropDatabaseAsync方法的具体用法?C# MongoClient.DropDatabaseAsync怎么用?C# MongoClient.DropDatabaseAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MongoDB.Driver.MongoClient
的用法示例。
在下文中一共展示了MongoClient.DropDatabaseAsync方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DropDatabaseAsync_should_invoke_the_correct_operation
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"));
}
示例2: DropDatabase_should_invoke_the_correct_operation
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"));
}
示例3: DropDatabase_should_invoke_the_correct_operation
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);
}
示例4: DropDatabase
public static void DropDatabase()
{
var client = new MongoClient(ConnectionString);
client.DropDatabaseAsync(DatabaseName).Wait();
}
示例5: Clean
public static void Clean()
{
var client = new MongoClient();
client.DropDatabaseAsync(settings.DatabaseName);
}
示例6: TestCleanup
public void TestCleanup()
{
var mongoClient = new MongoClient();
mongoClient.DropDatabaseAsync(DatabaseName).Wait();
}
示例7: DropDatabase
protected static void DropDatabase()
{
var mongoClient = new MongoClient();
mongoClient.DropDatabaseAsync(DatabaseName).Wait();
}