示例#1
0
        public async Task Check_Tally_Adds_Normal()
        {
            string postText1 =
                @"[X] Add this to your list of experiments for today.
[X] This is fine by you.
-[X] At least for today.";
            string postText2 =
                @"[X] Save it for another day.
[X] This is fine by you.
-[X] At least for today.";

            Post post1 = new Post(origin1, postText1);
            Post post2 = new Post(origin2, postText2);

            Assert.IsTrue(post1.HasVote);
            Assert.IsTrue(post2.HasVote);

            List <Post> posts = new List <Post>()
            {
                post1, post2
            };

            quest.PartitionMode = PartitionMode.None;

            await tally.TallyPosts(posts, quest, CancellationToken.None);

            List <VoteLineBlock> allVotes = voteCounter.VoteStorage.GetAllVotes().ToList();

            Assert.AreEqual(2, allVotes.Count);
            Assert.AreEqual(3, allVotes[0].Lines.Count);
            Assert.AreEqual(3, allVotes[1].Lines.Count);

            Assert.IsTrue(voteCounter.HasVoter(origin1.Author));
            Assert.IsTrue(voteCounter.HasVoter(origin2.Author));
        }