当前位置: 首页>>代码示例>>C#>>正文


C# ADatabase.Create方法代码示例

本文整理汇总了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);
        }
开发者ID:kangkot,项目名称:ArangoDB-NET,代码行数:16,代码来源:DatabaseOperationsTests.cs

示例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);
        }
开发者ID:kangkot,项目名称:ArangoDB-NET,代码行数:13,代码来源:DatabaseOperationsTests.cs

示例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);
        }
开发者ID:kangkot,项目名称:ArangoDB-NET,代码行数:15,代码来源:DatabaseOperationsTests.cs

示例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);
        }
开发者ID:kangkot,项目名称:ArangoDB-NET,代码行数:19,代码来源:DatabaseOperationsTests.cs

示例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);
        }
开发者ID:kangkot,项目名称:ArangoDB-NET,代码行数:18,代码来源:DatabaseOperationsTests.cs

示例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"));
        }
开发者ID:kangkot,项目名称:ArangoDB-NET,代码行数:16,代码来源:DatabaseOperationsTests.cs

示例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);
        }
开发者ID:kangkot,项目名称:ArangoDB-NET,代码行数:15,代码来源:Database.cs


注:本文中的Arango.Client.ADatabase.Create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。