本文整理汇总了C#中Arango.Client.ADatabase.Create方法的典型用法代码示例。如果您正苦于以下问题:C# ADatabase.Create方法的具体用法?C# ADatabase.Create怎么用?C# ADatabase.Create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Arango.Client.ADatabase
的用法示例。
在下文中一共展示了ADatabase.Create方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Should_fail_create_already_existing_database
public void Should_fail_create_already_existing_database()
{
Database.CleanupTestDatabases();
var db = new ADatabase(Database.SystemAlias);
var createResult = db.Create(Database.TestDatabaseGeneral);
var createResult2 = db.Create(Database.TestDatabaseGeneral);
Assert.AreEqual(409, createResult2.StatusCode);
Assert.IsFalse(createResult2.Success);
Assert.IsTrue(createResult2.HasValue);
Assert.IsFalse(createResult2.Value);
Assert.IsNotNull(createResult2.Error);
}
示例2: Should_create_database
public void Should_create_database()
{
Database.CleanupTestDatabases();
var db = new ADatabase(Database.SystemAlias);
var createResult = db.Create(Database.TestDatabaseOneTime);
Assert.AreEqual(201, createResult.StatusCode);
Assert.IsTrue(createResult.Success);
Assert.IsTrue(createResult.HasValue);
Assert.IsTrue(createResult.Value);
}
示例3: Should_delete_database
public void Should_delete_database()
{
Database.CleanupTestDatabases();
var db = new ADatabase(Database.SystemAlias);
var createResult = db.Create(Database.TestDatabaseGeneral);
var deleteResult = db.Drop(Database.TestDatabaseGeneral);
Assert.AreEqual(200, deleteResult.StatusCode);
Assert.IsTrue(deleteResult.Success);
Assert.IsTrue(deleteResult.HasValue);
Assert.IsTrue(deleteResult.Value);
}
示例4: Should_create_database_with_users
public void Should_create_database_with_users()
{
Database.CleanupTestDatabases();
var db = new ADatabase(Database.SystemAlias);
var users = new List<AUser>()
{
new AUser { Username = "admin", Password = "secret", Active = true },
new AUser { Username = "tester001", Password = "test001", Active = false }
};
var createResult = db.Create(Database.TestDatabaseOneTime, users);
Assert.AreEqual(201, createResult.StatusCode);
Assert.IsTrue(createResult.Success);
Assert.IsTrue(createResult.HasValue);
Assert.IsTrue(createResult.Value);
}
示例5: Should_fail_create_database_from_non_system_database
public void Should_fail_create_database_from_non_system_database()
{
Database.CleanupTestDatabases();
var db = new ADatabase(Database.SystemAlias);
var createResult = db.Create(Database.TestDatabaseGeneral);
var nonSystemDatabase = new ADatabase(Database.Alias);
var createResult2 = nonSystemDatabase.Create(Database.TestDatabaseOneTime);
Assert.AreEqual(403, createResult2.StatusCode);
Assert.IsFalse(createResult2.Success);
Assert.IsTrue(createResult2.HasValue);
Assert.IsFalse(createResult2.Value);
Assert.IsNotNull(createResult2.Error);
}
示例6: Should_get_list_of_all_databases
public void Should_get_list_of_all_databases()
{
Database.CleanupTestDatabases();
var db = new ADatabase(Database.SystemAlias);
var resultCreate = db.Create(Database.TestDatabaseOneTime);
var resultList = db.GetAllDatabases();
Assert.AreEqual(200, resultList.StatusCode);
Assert.IsTrue(resultList.Success);
Assert.IsTrue(resultList.HasValue);
Assert.IsTrue(resultList.Value.Contains(Database.TestDatabaseOneTime));
Assert.IsTrue(resultList.Value.Contains("_system"));
}
示例7: CreateTestDatabase
public static void CreateTestDatabase(string databaseName)
{
DeleteTestDatabase(databaseName);
var db = new ADatabase(Database.SystemAlias);
var resultList = db.GetAccessibleDatabases();
if (resultList.Success && resultList.Value.Contains(databaseName))
{
db.Drop(databaseName);
}
db.Create(databaseName);
}