Beispiel #1
0
        void RiskModOn_PubMethodB_Unmoderated_NewThread_internal(RiskModThreadEntryQueueInfo info)
        {
            using (IDnaDataReader reader = StoredProcedureReader.Create("", ConnectionDetails))
            {
                int siteid, forumid;
                GetRiskModTestSiteAndForum(reader, out siteid, out forumid);
                SetSiteModStatus(reader, siteid, "unmoderated");
                SetSiteRiskModState(reader, siteid, true, 'B');
                ClearEventQueue(reader);
                int latestThreadModId = GetLatestThreadModId(reader);

                string postText = "RiskModOn_PubMethodB_Unmoderated_NewThread";

                int? threadid, threadEntryId;
                RiskModTestPostHelper(reader, forumid, null, null, 42, postText, out threadid, out threadEntryId, false, false);

                CheckRiskModThreadEntryQueue(reader, threadEntryId, 'B', null, null, siteid, forumid, threadid, 42, "the furry one", null, "The Cabinet", postText, 1, "testip", testGUID.ToString(), DateTime.Now, 1, 0, null, 0, 0, 0, null, 0);

                CheckLatestThread(reader, (int)threadid, forumid, 1, 1, siteid);

                CheckLatestThreadEntry(reader, (int)threadid, forumid, 42, null, null, null, null, (int)threadEntryId, null, 0, 1, postText);

                // Check that no new entries have been created in the threadmod table
                Assert.AreEqual(latestThreadModId, GetLatestThreadModId(reader));

                int rmId = GetLatestRiskModThreadEntryQueueId(reader);

                Assert.IsTrue(CheckEventET_POSTNEEDSRISKASSESSMENTIsInQueue(reader, rmId, 42));
                Assert.IsTrue(CheckEventET_FORUMEDITEDIsInInQueue(reader, forumid, (int)threadid, 42));
                Assert.IsTrue(CheckEventET_POSTNEWTHREADIsInQueue(reader, forumid, (int)threadid, 42));
                Assert.IsTrue(CheckEventET_POSTTOFORUMIsInQueue(reader, forumid, (int)threadEntryId, 42));

                info.siteid = siteid;
                info.forumid = forumid;
                info.threadid = threadid;
                info.threadentryid = threadEntryId;
                info.posttext = postText;
            }
        }
Beispiel #2
0
        public void ProcessRiskModAssessment_PubMethodA_InReplyTo_Risky()
        {
            using (new TransactionScope())
            {
                using (IDnaDataReader reader = StoredProcedureReader.Create("", ConnectionDetails))
                {
                    ClearBIEventQueue(reader);

                    // Create a risk mod entry
                    var info = new RiskModThreadEntryQueueInfo();
                    RiskModOn_PubMethodA_Unmoderated_InReplyTo_internal(info);

                    int riskModId = GetLatestRiskModThreadEntryQueueId(reader);

                    GenerateBIEvents(reader);
                    Assert.IsTrue(CheckEventET_POSTNEEDSRISKASSESSMENTIsInBIEventQueue(reader, riskModId, 42));

                    bool? isRisky = null;
                    CheckRiskModThreadEntryQueue(reader, info.threadentryid, 'A', isRisky, null, info.siteid, info.forumid, info.inReplyToThread, 42, "the furry one", info.inReplyTo, "The Cabinet", info.posttext, 1, "testip", testGUID.ToString(), DateTime.Now, 1, 0, null, 0, 0, 0, null, 0);

                    int latestThreadId = GetLatestThreadId(reader);
                    int latestThreadEntryId = GetLatestThreadEntryId(reader);

                    int? newThreadId, newThreadEntryId;
                    RiskMod_ProcessRiskAssessmentForThreadEntry(reader, riskModId, "Risky", out newThreadId, out newThreadEntryId);

                    isRisky = true;
                    TestDate td = new TestDate() { TestDateTime = DateTime.Now };
                    CheckRiskModThreadEntryQueue(reader, newThreadEntryId, 'A', isRisky, td, info.siteid, info.forumid, info.inReplyToThread, 42, "the furry one", info.inReplyTo, "The Cabinet", info.posttext, 1, "testip", testGUID.ToString(), DateTime.Now, 1, 0, null, 0, 0, 0, null, 0);

                    CheckLatestThreadMod(reader, info.forumid, info.inReplyToThread, newThreadEntryId, null, 0, "[The post will be published after moderation. Queued by risk moderation]", info.siteid, 1);

                    int modId = GetLatestThreadModId(reader);
                    CheckLatestPremodPostings(reader, modId, 42, info.forumid, info.inReplyToThread, info.inReplyTo, info.posttext, 1, info.siteid, 0, riskModId);

                    // check no mod queue entry was created
                    Assert.AreEqual(latestThreadId, GetLatestThreadId(reader));
                    Assert.AreEqual(latestThreadEntryId, GetLatestThreadEntryId(reader));
                }
            }
        }
Beispiel #3
0
        public void ProcessRiskModAssessment_PubMethodB_NewThread_Risky()
        {
            using (new TransactionScope())
            {
                using (IDnaDataReader reader = StoredProcedureReader.Create("", ConnectionDetails))
                {
                    ClearBIEventQueue(reader);

                    // Create a risk mod entry
                    var info = new RiskModThreadEntryQueueInfo();
                    RiskModOn_PubMethodB_Unmoderated_NewThread_internal(info);

                    int riskModId = GetLatestRiskModThreadEntryQueueId(reader);

                    GenerateBIEvents(reader);
                    Assert.IsTrue(CheckEventET_POSTNEEDSRISKASSESSMENTIsInBIEventQueue(reader, riskModId, 42));

                    bool? isRisky = null;
                    CheckRiskModThreadEntryQueue(reader, info.threadentryid, 'B', isRisky, null, info.siteid, info.forumid, info.threadid, 42, "the furry one", null, "The Cabinet", info.posttext, 1, "testip", testGUID.ToString(), DateTime.Now, 1, 0, null, 0, 0, 0, null, 0);

                    int? newThreadId, newThreadEntryId;
                    RiskMod_ProcessRiskAssessmentForThreadEntry(reader, riskModId, "Risky", out newThreadId, out newThreadEntryId);

                    Assert.IsNull(newThreadId);
                    Assert.IsNull(newThreadEntryId);

                    isRisky = true;
                    TestDate td = new TestDate() { TestDateTime = DateTime.Now };
                    CheckRiskModThreadEntryQueue(reader, info.threadentryid, 'B', isRisky, td, info.siteid, info.forumid, info.threadid, 42, "the furry one", null, "The Cabinet", info.posttext, 1, "testip", testGUID.ToString(), DateTime.Now, 1, 0, null, 0, 0, 0, null, 0);

                    // Check that an entry ended up in the thread mod queue
                    CheckLatestThreadMod(reader, info.forumid, info.threadid, info.threadentryid, null, 0, "[The post was published before being queued by risk moderation]", info.siteid, 0);
                }
            }
        }
Beispiel #4
0
        void RiskModOn_PubMethodA_Unmoderated_InReplyTo_internal(RiskModThreadEntryQueueInfo info)
        {
            using (IDnaDataReader reader = StoredProcedureReader.Create("", ConnectionDetails))
            {
                int siteid, forumid;
                GetRiskModTestSiteAndForum(reader, out siteid, out forumid);
                SetSiteModStatus(reader, siteid, "unmoderated");
                ClearEventQueue(reader);
                int latestThreadModId = GetLatestThreadModId(reader);

                string postText1 = "RiskModOn_PubMethodA_Unmoderated_InReplyTo";

                // Turn off risk mod to start with
                SetSiteRiskModState(reader, siteid, false, 'A');

                // Get a thread entry to reply to
                int? threadid, threadEntryId, inReplyToThread, inReplyTo;
                RiskModTestPostHelper(reader, forumid, null, null, 42, postText1, out inReplyToThread, out inReplyTo, false, false);

                // Turn on risk mod, to test inReplyTo behaviour
                SetSiteRiskModState(reader, siteid, true, 'A');

                string postText2 = "replying to prev post";
                RiskModTestPostHelper(reader, forumid, inReplyToThread, inReplyTo, 42, postText2, out threadid, out threadEntryId, false, false);

                CheckRiskModThreadEntryQueue(reader, threadEntryId, 'A', null, null, siteid, forumid, inReplyToThread, 42, "the furry one", inReplyTo, "The Cabinet", postText2, 1, "testip", testGUID.ToString(), DateTime.Now, 1, 0, null, 0, 0, 0, null, 0);

                CheckLatestThread(reader, (int)inReplyToThread, forumid, 1, 1, siteid);

                CheckLatestThreadEntry(reader, (int)inReplyToThread, forumid, 42, null, null, null, null, (int)inReplyTo, null, 0, 1, postText1);

                // Check that no new entries have been created in the threadmod table
                Assert.AreEqual(latestThreadModId, GetLatestThreadModId(reader));

                int rmId = GetLatestRiskModThreadEntryQueueId(reader);

                Assert.IsTrue(CheckEventET_POSTNEEDSRISKASSESSMENTIsInQueue(reader, rmId, 42));
                Assert.IsTrue(CheckEventET_FORUMEDITEDIsInInQueue(reader, forumid, (int)inReplyToThread, 42));
                Assert.IsTrue(CheckEventET_POSTNEWTHREADIsInQueue(reader, forumid, (int)inReplyToThread, 42));
                Assert.IsTrue(CheckEventET_POSTTOFORUMIsInQueue(reader, forumid, (int)inReplyTo, 42));

                info.forumid = forumid;
                info.siteid = siteid;
                info.posttext = postText2;
                info.threadid = threadid;
                info.threadentryid = threadEntryId;
                info.inReplyTo = inReplyTo;
                info.inReplyToThread = inReplyToThread;
            }
        }