Beispiel #1
0
        public async Task Check_Tally_Adds_Plan()
        {
            string postText1 =
                @"[X] Plan Experiment
-[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));
            Assert.IsTrue(voteCounter.HasPlan("Experiment"));

            var vote1 = voteCounter.VoteStorage.GetVotesBy(origin1);

            Assert.AreEqual(1, vote1.Count);

            var voters1 = voteCounter.GetVotersFor(vote1[0]);

            Assert.AreEqual(2, voters1.Count());
        }