Esempio n. 1
0
        public void Delete_Poll_Admin_Check()
        {
            setUpPoll();

            Assert.That(PollController.DeletePoll(1, "Admin2"), Is.EqualTo(true));

            File.Delete(Constants.pollPath);
        }
Esempio n. 2
0
        public void Delete_Poll_Failed_Check()
        {
            setUpPoll();

            Assert.That(PollController.DeletePoll(1, "test"), Is.EqualTo(false));

            File.Delete(Constants.pollPath);
        }
Esempio n. 3
0
        public async Task DeletePoll(string id)
        {
            // Discord user info
            var msg       = Context.Message;
            var discordId = msg.Author.Username;

            bool hasDeleted = PollController.DeletePoll(Convert.ToInt32(id), discordId);

            if (hasDeleted == true)
            {
                await ReplyAsync($"{id} was deleted");
            }

            else
            {
                await ReplyAsync($"You cannot delete someone elses poll! Not cool...");
            }
        }