public void VoteForQuestion(string id, Vote vote)
        {
            Question question = m_questionRepository.GetById(id);
            if (question == null)
            {
                throw new ApplicationException("Question Id wasn't found");
            }

               m_questionRepository.AddVote(id, vote);
        }
        public void AddVote()
        {
            Question q = new Question
            {
                QuestionText = "What's the question?",
            };

            IQuestionRepository repo = ObjectFactory.GetInstance<IQuestionRepository>();
            Question newlyAddedQuestion = repo.Add(q);

            Vote vote = new Vote
            {
                Answer = VoteAnswer.Yes
            };

            repo.AddVote(newlyAddedQuestion.Id, vote);

            Question result = repo.GetById(newlyAddedQuestion.Id);
            Assert.AreEqual(1, result.Votes.Count);
            Assert.AreEqual(VoteAnswer.Yes, result.Votes[0].Answer);
        }
 public void AddVote(string questionId, Vote vote)
 {
     var query = Query.EQ("_id", new ObjectId(questionId));
     var update = Update.PushWrapped("Votes", vote);
     m_repository.Collection.Update(query, update, UpdateFlags.None, WriteConcern.Acknowledged);
 }