예제 #1
0
        public async Task DisposeAsync()
        {
            var failed = GetPowershellErrors();

            PowerShell.Dispose();
            if (Environment.GetEnvironmentVariable("idsvr_mongodb_no_teardown") == null)
            {
                if (await _client.DatabaseExistsAsync(Database))
                {
                    await _client.DropDatabaseAsync(Database);
                }
            }
            //var dbns = (await (await _client.ListDatabasesAsync()).ToListAsync()).Select(x => x["name"].AsString);
            //foreach (var dbn in dbns)
            //{
            //    Guid ignored;
            //    if (Guid.TryParse(dbn, out ignored))
            //        await _client.DropDatabaseAsync(dbn);
            //}

            if (failed != null)
            {
                ExceptionDispatchInfo.Capture(failed).Throw();
            }
        }
        public async Task CreateDatabase()
        {
            var defaults = StoreSettings.DefaultSettings();

            Assert.False(await _client.DatabaseExistsAsync(_database));
            _ps.Invoke();
            Assert.True(await _client.DatabaseExistsAsync(_database));
            var db = _client.GetDatabase(_database);

            Assert.True(await db.CollectionExistsAsync(defaults.AuthorizationCodeCollection), "Authoriz");
            Assert.True(await db.CollectionExistsAsync(defaults.ClientCollection));
            Assert.True(await db.CollectionExistsAsync(defaults.ConsentCollection));
            Assert.True(await db.CollectionExistsAsync(defaults.RefreshTokenCollection));
            Assert.True(await db.CollectionExistsAsync(defaults.ScopeCollection));
            Assert.True(await db.CollectionExistsAsync(defaults.TokenHandleCollection));

            await _client.DropDatabaseAsync(_database);
        }
예제 #3
0
 public async Task DatabaseShouldBeDeleted()
 {
     Assert.True(await _server.DatabaseExistsAsync(_database));
     _ps.Invoke();
     Assert.False(await _server.DatabaseExistsAsync(_database));
 }