GetAccessibleDatabases() public method

Retrieves list of accessible databases which current user can access without specifying a different username or password.
public GetAccessibleDatabases ( ) : AResult>
return AResult>
        public void Should_get_list_of_accessible_databases()
        {
            Database.CleanupTestDatabases();

            var db = new ADatabase(Database.SystemAlias);

            var resultCreate = db.Create(Database.TestDatabaseOneTime);

            var resultList = db.GetAccessibleDatabases();

            Assert.AreEqual(200, resultList.StatusCode);
            Assert.IsTrue(resultList.Success);
            Assert.IsTrue(resultList.HasValue);
            Assert.IsTrue(resultList.Value.Contains(Database.TestDatabaseOneTime));
        }
示例#2
0
        public static void DeleteTestDatabase(string databaseName)
        {
            var db = new ADatabase(Database.SystemAlias);

            var resultList = db.GetAccessibleDatabases();

            if (resultList.Success && resultList.Value.Contains(databaseName))
            {
                db.Drop(databaseName);
            }
        }