Exemplo n.º 1
0
        public async Task Check_Original_User_Can_Replace_Plan()
        {
            string postText1 =
                @"[X] Plan: Experiment
-[X] Add this to your list of experiments for today.
-[X] This is fine by you.
--[X] At least for today.";
            string postText2 =
                @"[X] Plan: Experiment
-[X] Alchemy structure
-[X] Pea soup
--[X] At least for today.";

            quest.PartitionMode           = PartitionMode.None;
            quest.AllowUsersToUpdatePlans = true;
            voteCounter.Quest             = quest;
            List <Post> posts;

            Post post1 = new Post(origin1, postText1);
            Post post2 = new Post(origin2, postText2);
            Post post3 = new Post(origin3, postText2);
            Post post4 = new Post(origin1a, postText2);

            posts = new List <Post>()
            {
                post1, post2
            };
            voteCounter.AddPosts(posts);
            var plans = await tally.PreprocessPosts(default);
Exemplo n.º 2
0
        public void Simple_Reference()
        {
            quest.PartitionMode     = PartitionMode.ByLine;
            quest.DisableProxyVotes = false;
            voteCounter.Quest       = quest;

            string voteText1 = oneLine;
            string voteText2 = refKinematics;
            Post   post1     = GetPostFromKinematics1(voteText1);
            Post   post2     = GetPostFromAtreya(voteText2);

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

            voteCounter.AddPosts(posts);
            voteCounter.AddReferenceVoter(post1.Origin);
            voteCounter.AddReferenceVoter(post2.Origin);

            var results1 = voteConstructor.ProcessPostGetVotes(post1, quest);

            if (results1 != null)
            {
                voteCounter.AddVotes(results1, post1.Origin);

                var results2 = voteConstructor.ProcessPostGetVotes(post2, quest);

                if (results2 != null)
                {
                    Assert.IsTrue(results1[0].Lines[0] == results2[0].Lines[0]);

                    voteCounter.AddVotes(results2, post2.Origin);

                    Assert.AreEqual(2, voteCounter.VoteStorage.GetSupportCountFor(results1[0]));
                }

                Assert.IsFalse(results2 == null);
            }

            Assert.IsFalse(results1 == null);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Run the tally using the provided posts, for the selected quest.
 /// </summary>
 /// <param name="posts">The posts to be tallied.</param>
 /// <param name="quest">The quest being tallied.</param>
 /// <param name="token">Cancellation token.</param>
 public async Task TallyPosts(IEnumerable <Post> posts, IQuest quest, CancellationToken token)
 {
     voteCounter.Quest = quest;
     voteCounter.AddPosts(posts);
     await TallyPosts(token).ConfigureAwait(false);
 }