Esempio n. 1
0
        public static IDatabaseActionFactory CreateDatabaseActionFactory(InMemoryBotConfigurationContextFactory factory)
        {
            Mock <IDatabaseActionFactory> mockDbActionFactory = new Mock <IDatabaseActionFactory>();

            mockDbActionFactory
            .Setup(dbActionFactory => dbActionFactory.Create())
            .Returns(() => new DatabaseAction(factory.Create()));
            return(mockDbActionFactory.Object);
        }
        public void InitializeTest()
        {
            this.botConfigurationfactory = new InMemoryBotConfigurationContextFactory();

            // Make sure the database is initialized before running the test
            using (BotConfigurationContext context = this.botConfigurationfactory.Create())
            {
                context.Database.Migrate();
            }
        }
Esempio n. 3
0
        public async Task PairNewChannelAndUpdateChannel()
        {
            const ulong textChannelId     = 12345;
            const ulong voiceChannelId    = 123456;
            const ulong newVoiceChannelId = 123567;

            using (InMemoryBotConfigurationContextFactory factory = new InMemoryBotConfigurationContextFactory())
                using (BotConfigurationContext context = factory.Create())
                    using (DatabaseAction action = new DatabaseAction(context))
                    {
                        await action.MigrateAsync();

                        await action.PairChannelsAsync(guildId, new (ulong, ulong)[] { (textChannelId, voiceChannelId) });
Esempio n. 4
0
        public void InitializeTest()
        {
            this.botConfigurationfactory = new InMemoryBotConfigurationContextFactory();

            // Make sure the database is initialized before running the test
            using (BotConfigurationContext context = this.botConfigurationfactory.Create())
            {
                context.Database.Migrate();
            }

            // Clear out the old fields
            this.Handler = null;
            this.GoogleSheetsGeneratorFactory = null;
            this.GuildTextChannel             = null;
            this.MessageStore = null;
        }