public void RebuildDatabaseTest()
        {
            TestDb = DataBaseMock();
            TestDb.Setup(m => m.EmptyKnockoutDatabase("1234")).Verifiable();

            var knockoutTest = new KnockOutHandler(1234, TestDb.Object);

            knockoutTest.RebuildDataBase();

            Assert.DoesNotThrow(() => TestDb.Verify());
        }
Пример #2
0
        public async Task RebuildDatabasesAsync()
        {
            if (!StateChecker.IsKnockoutChannel(Context) || StateChecker.IsPrivateMessage(Context))
            {
                return;
            }

            if (!StateChecker.IsChannelOp(Context))
            {
                await Context.Channel.SendMessageAsync(":x: You are not a channel op!");

                return;
            }

            await Context.Channel.SendMessageAsync("!!! All databases are being rebuilt and purged !!!");

            var knockouts = new KnockOutHandler(Context.Channel.Id, Factory.GetDatabase());

            knockouts.RebuildDataBase();

            await Context.Channel.SendMessageAsync("!!! Done !!!");
        }