예제 #1
0
        public async Task VoteOnPoll(string id, string vote)
        {
            // Discord user info
            var msg       = Context.Message;
            var discordId = msg.Author.Username;

            string hasVoted = PollController.VoteOnPoll(id, vote, discordId);

            await ReplyAsync(hasVoted);
        }
예제 #2
0
        public void Vote_Poll_No_Check()
        {
            File.Delete(Constants.pollPath);

            setUpPoll();

            string voted = PollController.VoteOnPoll("1", "no", "Admin");

            Assert.AreEqual(voted, "Thanks for the vote");

            string answer = PollController.ReurnCurrentPolls();

            Assert.AreEqual(answer, $"1, {question}?,Yes: 0, No: 1 \n");

            File.Delete(Constants.pollPath);
        }
예제 #3
0
        public void Vote_Poll_Failed_Check()
        {
            File.Delete(Constants.pollPath);

            setUpPoll();

            string voted = PollController.VoteOnPoll("1", "cake", "Admin");

            Assert.AreEqual(voted, "Did not update");

            string answer = PollController.ReurnCurrentPolls();

            Assert.AreEqual(answer, $"1, {question}?,Yes: 0, No: 0 \n");

            File.Delete(Constants.pollPath);
        }
예제 #4
0
        public void Vote_Poll_Already_Voted_Check()
        {
            File.Delete(Constants.pollPath);

            setUpPoll();

            PollController.VoteOnPoll("1", "yes", "Admin");
            string voted = PollController.VoteOnPoll("1", "yes", "Admin");

            Assert.AreEqual(voted, "You have already Voted!");

            string answer = PollController.ReurnCurrentPolls();

            Assert.AreEqual(answer, $"1, {question}?,Yes: 1, No: 0 \n");

            File.Delete(Constants.pollPath);
        }