Пример #1
0
        public async Task RemoveFromNonexistentTournament()
        {
            const ulong              otherId        = DefaultUserId + 1;
            MessageStore             messageStore   = new MessageStore();
            ICommandContext          context        = this.CreateCommandContext(messageStore);
            GlobalTournamentsManager globalManager  = new GlobalTournamentsManager();
            BotCommandHandler        commandHandler = new BotCommandHandler(context, globalManager);

            IGuildUser guildUser = this.CreateGuildUser(otherId);
            await commandHandler.RemoveTournamentDirectorAsync(guildUser, DefaultTournamentName);

            string expectedMessage = BotStrings.TournamentDoesNotExist(DefaultTournamentName, DefaultGuildName);

            messageStore.VerifyChannelMessages(expectedMessage);
        }
Пример #2
0
        public async Task RemoveNonexistentTournamentDirector()
        {
            const ulong              otherId        = DefaultUserId + 1;
            MessageStore             messageStore   = new MessageStore();
            ICommandContext          context        = this.CreateCommandContext(messageStore);
            GlobalTournamentsManager globalManager  = new GlobalTournamentsManager();
            BotCommandHandler        commandHandler = new BotCommandHandler(context, globalManager);

            AddTournamentDirectorDirectly(globalManager, DefaultUserId);

            IGuildUser guildUser = this.CreateGuildUser(otherId);
            await commandHandler.RemoveTournamentDirectorAsync(guildUser, DefaultTournamentName);

            string expectedMessage = BotStrings.UserNotTournamentDirector(DefaultTournamentName, DefaultGuildName);

            messageStore.VerifyChannelMessages(expectedMessage);

            TournamentsManager manager = globalManager.GetOrAdd(DefaultGuildId, id => new TournamentsManager());

            Assert.IsTrue(
                manager.TryGetTournament(DefaultTournamentName, out ITournamentState state), "Could not find tournament.");
            Assert.IsFalse(state.IsDirector(otherId), "Director should not have been added.");
        }